11

I wish to sync my portable with my Maemo smartphone for just the files in my working directory (top level folder). What can I do to correct my rsync command to sync files in the source folder but not directories?

rsync -va --no-r --no-R --no-d /home/Xtian/ /run/media/486D-8336/
skipping directory.
sent 10 bytes  received 12 bytes  44.00 bytes/sec
total size is 0  speedup is 0.00

The command begins with verbose and archive options as default. Then I attempted to turn off recursive, relative, and directories. In other words don't follow the tree, don't copy the tree, in fact don't even bother with the folders.

2 Answers 2

4

I would try this:

rsync -vt /home/Xtian/* /run/media/486D-8336/

This will skip non regular files and enables just the timestamps on files in order to sync only the differences the next time you run it.

From man rsync: -a flag is an alias for -rlptgoD. You can add additional flags if you need to preserve other file attributes.

1
  • You would need the --no-r --no-R --no-d options also to do what the op is asking. Personally I find the -a flag useful, but -t will suffice to be efficient.
    – drevicko
    Aug 27, 2020 at 0:55
3

Try this:

rsync -r --exclude='*/' source/ destination/

Source: https://lists.samba.org/archive/rsync/2008-September/021746.html

1
  • I believe that will copy files in sub-folders if those folders exist in destination/
    – drevicko
    Aug 27, 2020 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.