I tried moving files from one directory to another and didn't work. so I searched and found an answer that fits what I want. When I run it, modified to my directory, it gives
What is want to do:
${filename,,*}: bad substitution!
This is what I used:
for filename in *; do
case "${filename,,*}" in
b01.nii*) mv "$filename" "$/Users/dave/Desktop/test/untitled_folder_*/str" ;;
vol_01.nii*) mv "$filename" "$/Users/dave/Desktop/test/untitled_folder_*/rs" ;;
*) echo "don't know where to put $filename";;
esac
done
Thank you
you two errors:
the main problem is the for command, the variable
$filenamecontains*and not the real file name. you should usefor filename in$(find . -name "*");dothe second one is the case:
you have to be sure about
$filenamevariable's value i.e. in my bash shell the filename output isit's better to use the following syntax in the case
./b01.nii* )I've replaced your
mvwithechojust to test the script:my output is
Regards
Claudio