I'd like to move all sub-folders starting with a given suffix (Blah_ in the example) into an other directory using a linux bash script. Here's what the script looks like:
srcDir="/home/me/"
archiveDir="/Archive/"
prefix="Blah_"
mv -v -f "$srcDir$prefix*" -t $archiveDir
Though there are a lot of directories starting with 'Blah_', inside /home/me, this leads to the following error message:
mv: cannot stat `/home/me/Blah_*': No such file or directory
Now I'm curious whats wrong here. How must the above script be changed in order to move all subfolders starting with 'Blah' into the archive folder?
Best Answer
in this case if you quote, * will be interpreted literally