Help with a shell script that’s not moving files?
I'm hoping someone can help me solve a Shell Script problem I have. The Shell Script should move a number of files to specific folders based on what it finds in the filenames.
I've managed to cobble something together but I can't get it to move any files.
Here is the folder structure:
Desktop > testing > Source
Desktop > testing > client name here_Logo set > Black > CMYK
And here are some sample filenames in the Source folder:
client name here_black_CMYK.eps
client name here_black_CMYK.jpg
client name here_black_CMYK.png
client name here_black_RGB.eps
client name here_black_RGB.jpg
client name here_black_RGB.png
This is my code:
kmVAR="client name here"
theSet=${kmVAR// /\\ }
Dst_FolderEnd="_Logo\ set"
Black="/Black"
CMYK="/CMYK"
Src_Folder=~/Desktop/testing/Source/
Dst_Folder=~/Desktop/testing/
Dst_blackCMYK=$Dst_Folder$theSet$Dst_FolderEnd$Black$CMYK
cd $Src_Folder
for file in *;do
if [[ "$file" == *"$theSet"* && "$file" == *"black_CMYK"* && "$file" != *"ai"* ]];then
mv "$file" "$Dst_blackCMYK"
fi
done
If anyone can help, that would be awesome. Many thanks.