commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
use find with rsync
There are 2 alternatives - vote for the best!
rsync from source to dest all between >30
'-mtime -10' syncs only files newer 10 days (-mtime is just one example, use whatever find expressions you need)
printf %P: File's name with the name of the command line argument under which it was found removed.
this way, you can use any src directory, no need to cd into your src directory first.
using \\0 in printf and a corresponding --from0 in rsync ensures that even filenames with newline characters work (thanks syssyphus for #3808).
both, #1481 and #3808 just work if you either copy the current directory (.) , or the filesystem root (/), otherwise the output from find and the source dir from rsync just don't match. #7685 works with an arbitrary source directory.
If you can do better, submit your command here.
You must be signed in to comment.