Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like rsync to print modified and deleted files. The verbose option (-v) does print modified files but also the list of subdirectories, maybe because touched directories are considered modified. Since I sync a lot of files from a lot of subdirectories, it's impossible to see the actual changes.

So, is there a way to not print directories using rsync ?

Im not looking for grep -v "*/$" kind of answers since it would also exclude new directories.

Command I am using: rsync -avh --delete /media/data/src /media/data/bkp

And everytime it prints the list of all directories:

src/dir1/

src/dir1/sdir1/

src/dir1/sdir2/

src/dir2/

EDIT: Ok, after some intensive tests .. It doesn't print all directories when syncing from an ext4 partition to an ext4 and from NTFS to NTFS. It only does when syncing from ext4 to NTFS .. And options -c or --omit-dir-times don't change that.

share|improve this question

5 Answers 5

You could try using --omit-dir-times switch to ignore directory times (take a look at rsync man page).

I personally find that using -c switch is the best way to ensure that only the files whose contents has been changed show up in the output.

Note that using -c will slow down rsync.

share|improve this answer
    
Thanks for the reply. I find hard to believe it's not natively supported, at least without losing perfomance (or options) .. I'll just have to trust it syncs it all. –  qox Sep 10 '12 at 20:03
    
Sorry, my edit changed the question after your answer. –  qox Sep 12 '12 at 9:00
up vote 0 down vote accepted

Looks like it was a permission issue. Not sure why .. But I've edited /etc/fstab for NTFS partitions and it now works as expected, ie no printing of directories that haven't been modified.

Old fstab entry: ntfs-3g users,defaults,exec,uid=1000 0 0

New fstab entry: ntfs-3g users,defaults,exec,uid=1000,gid=1000,dmask=077,fmask=137 0 0

Im guessing (who knows ..) dmask=077 did the trick ie 'drwx---' instead of 'drwxrwx'.

share|improve this answer

Instead of changing the mount type you can also tell rsync to ignore file permissions when copying to a filesystem that doesn't support it. The following command works for me.

From the rsync man page:

In summary: to give destination files (both old and new) the source permissions, use --perms. To give new files the destination-default permissions (while leaving existing files unchanged), make sure that the --perms option is off and use --chmod=ugo=rwX (which ensures that all non-masked bits get enabled). If you’d care to make this latter behavior easier to type, you could define a popt alias for it, such as putting this line in the file ~/.popt (the following defines the -Z option, and includes --no-g to use the default group of the destination dir):

rsync alias -Z --no-p --no-g --chmod=ugo=rwX
share|improve this answer

don't use -a, it contain -p -o -g.

share|improve this answer

I used:

sudo rsync -auzhni --progress --omit-dir-times --no-o  src_dir/ dst_dir 

It is a dry run (option n). Remove that option in order to have rsync actually transfer files.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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