Move files into folders based on patterns
How to move files ending with a number into folders ending with numbers
touch {first,second,third}_{01..12}.tifCopy files with the same number ending into folder with the same numbers
for file in *; do install -D "$file" "${file: -6:2}/${file}"; doneCopy the files with the same beginning (before underscore) into folders with the same beginning
regex='(.*)_(.*).tif';
for file in *;
do
if [[ $file =~ $regex ]]
then install -D "$file" "${BASH_REMATCH[1]}/${file}";
fi
doneLast updated