I'm fooling around over here creating a bash script to transfer the contents of one directory to another. It works fine as long as the directory or file doesn't contain a space. The second I have a space involved the script doesn't work.
for FILE in `ls -A $OLDIR`
mv $OLDIR/"$FILE" $NEWDIR/
echo "$FILE moved from $OLDIR to $NEWDIR"
I use two arguments to define which directory I am copying from and which directory to copy to. How can I get this to work on files and directories that have spaces?
Any and all help is greatly appreciated.