Notice that both sample scripts in the replies have double quotes around them.
The double quotes prevent the filename from being parsed by the shell as two or more arguments instead of one. This is because a space is the first value of the IFS variable.
Code:
for i in `find /home/hamish/ -type f -mtime 0` do
for i in `cat /tmp/files.txt`; do ls -lah "$i"; done
Using the -print0 of find in combination with the -0 option of xargs may also be the way to go. You would need to use the --target-directory option of mv.
Code:
find ./ find /home/hamish/ -type f -mtime 0 -print0 | xargs --max-lines=100 mv --target-dirctory <target-directory>
Using the -print0 and the (--null/-0) options you can have names with whitespace, quotes and backslashes according to the xargs manpage. The
--max-lines/-l option sets the maximum number of lines handled at one time. This can prevent out-of-memory errors when working with very large directories.
Another thing to try is to have the mv command executed in
find using
-exec. Notice again the use of double quotes:
Code:
find /home/hamish/ -type f -mtime 0 -exec mv -t <dest-directory> "{}" \;