Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do not show directories in rsync output

Does anybody know if there is an rsync option, so that directories that are being traversed do not show on stdout.

I'm syncing music libraries, and the massive amount of directories make it very hard to see which file changes are actually happening. I'v already tried -v and -i, but both also show directories.

like image 790
Koen Weyn Avatar asked Dec 20 '11 19:12

Koen Weyn


People also ask

How do I ignore files in rsync?

Exclude Files and Directories from a List. When you need to exclude a large number of different files and directories, you can use the rsync --exclude-from flag. To do so, create a text file with the name of the files and directories you want to exclude. Then, pass the name of the file to the --exlude-from option.

How do I rsync a specific file?

Copy a single file locally If you want to copy a file from one location to another within your system, you can do so by typing rsync followed by the source file name and the destination directory. Note: Instead of “/home/tin/file1. txt”, we can also type “file1” as we are currently working in the home directory.

What is the command to check rsync?

Show rsync Progress During Data TransferAdd the --progress flag to the rsync command to view the amount of data transferred, transfer speed, and the remaining time.

Is rsync available on Linux?

Rsync is a very flexible network-enabled syncing tool. Due to its ubiquity on Linux and Unix-like systems and its popularity as a tool for system scripts, it's included on most Linux distributions by default.


1 Answers

If you're using --delete in your rsync command, the problem with calling grep -E -v '/$' is that it will omit the information lines like:

deleting folder1/ deleting folder2/ deleting folder3/folder4/ 

If you're making a backup and the remote folder has been completely wiped out for X reason, it will also wipe out your local folder because you don't see the deleting lines.

To omit the already existing folder but keep the deleting lines at the same time, you can use this expression :

rsync -av --delete remote_folder local_folder | grep -E '^deleting|[^/]$' 
like image 166
Zurd Avatar answered Nov 11 '22 15:11

Zurd