THE QUESTION
I am trying to rsync all files in the last X (10) days. This command is how to do it:
Code:
rsync `find . -name "*" -mtime -10` ~/destination
And it works perfectly, except that if I have a space in a file name, it treats each space-delimited fragment as a separate file.
I know that if I have filenames with spaces, I have to backquote the spaces and possibly quote the filename. I can do this file by file, but don't know how to process the find command to add them in.
Anyone have a tip of how to do this?
I've got some ideas, but haven't implemented any correctly and thought it would be time for help.
- pipe the find results to sed to add quote each line
- pipe to sed and add replace " " with "\ "
- output to file and use the rsync option to specify a file list, "--files-from=" (do I need to quote each line of find)
- use find with -print0 and use xargs