0

I would like rsync to output the list of files which it actually copied, respectively deleted. From the man page, I though the following command will do:

rsync -a --info=backup2,copy2,del2 SOURCEDIR DESTDIR

By looking at DESTDIR afterwards, I see that the files are updated, but I don't get any list of files from rsync. Also tried it with just --info=backup,copy,del, but to no avail.

Why is it that my approach doesn't work, and how can I do it properly?

2

Your concept of backup is different to that used by rsync. In rsync a backup is a copy on the destination of the original file before it was updated by rsync. Your command doesn't create any backups, so none will be listed.

Similarly, your concept of copy is different to that used by rsync. There are no copies made, so none will be listed.

This will get you a list of the files transferred or deleted, but note that neither your command nor this specifies that files are to be deleted (--delete), so the del is actually a no-op.

rsync -a --info=name,del SOURCEDIR/ DESTDIR | grep -v '/$'
  • Thanks for pointing this out. As for the --delete, I missed to write it in my post when I simplified for the purpose of this posting the (pretty complex) rsync command. I'm surprised to learn that there is a difference between copying and transfering files! – user1934428 Jun 22 '18 at 11:56
  • 1
    @user1934438 copying is when there is already an instance of the file on the target, in a parallel directory. The file can be copied from there instead of transferred across from the source. – roaima Jun 22 '18 at 15:21
  • 1
    Absolute excellent explanation! I have been searching for one hour how to get "just" the list of transferred files.. :-( and it seems that the grep command is not something you can avoid.. (because of timestamp changes or something like that). It's really not easy to understand their vocabulary and to do something that seems fairly common to wish :-). Thanks. – Christophe Muller May 16 at 15:52
  • @ChristopheMuller thanks. I'm pleased this answer helped you. – roaima May 16 at 15:54

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.