the script is fixed now (also edited the post that had the script to reflect the fixes).
it was a missing " and ; now fixed and working.
still wondering if theres a way to hide the errors that show when theres no files to move.
.........glad you found the problem....
As for hiding errors, the way to do that is to generate a list of all the files being looked for on-the-fly, and then
move any files found.......This is easily done by piping an 'ls' command to a 'while' loop, like so:
ls *.<ext> | while read, do mv $REPLY <target dir>; done
That way, if there are no files found with the matching extension, the while loop has nothing to do and the script simply moves on to the next command........
And, if you don't mind, here's a coding tip I like to do..........Replace all those consecutive 'echo' commands with a single "here-document".........This will also reduce the chance of forgetting a quote, since there will be less quotes in the script
So, recoding the "Script Starting" intro would look like this:
Greetings $USER! Welcome to my cleanup script.
Depending on the speed of your computer
and how many files you have to move
and their size, this could take awhile.
read -p "Are you ready (yes or no)? " ANSWER
Notice I also replaced the 'echo -n' command followed by 'reply' using only a 'reply -p' command....'reply -p' does the same thing as 'echo -n' followed by 'reply'.....Read up on the bash manpage about here-documents and the 'read' builtin command
This is mainly a personal choice, and not to be taken as the "correct" way........To me it's a bit easier to read and less prone to missing a quote (believe me, this is a not uncommon error when coding)........
PS: You can also replace all those 'mkdir' commands with a single one:
mkdir -p $MP3DIR $OGGDIR $TEXTDIR $VIDDIR
And, redirecting ouput to the 'bit bucket' (/dev/null) should not be necessary, as 'mkdir -p' shouldn't output anything, whether the directory exists or not.... The -p switch will suppress errors if the directory does exist, as documentated in the manpage.......