I am using rsync to make backups. During the backup process, the following rsync command is used to check how many files have been changed:
rsync --dry-run --stats -a /path/to/source/dir/ /path/to/destination/dir/
The command gives me output similar to this:
Number of files: 3 Number of files transferred: 1 Total file size: 6 bytes Total transferred file size: 6 bytes Literal data: 0 bytes Matched data: 0 bytes File list size: 80 File list generation time: 0.001 seconds File list transfer time: 0.000 seconds Total bytes sent: 104 Total bytes received: 23 sent 104 bytes received 23 bytes 254.00 bytes/sec total size is 6 speedup is 0.05 (DRY RUN)
I can then parse this text and retrieve data about how many files need to be transfered and total file size needed to be transfered. Based on that I will decide whether I need to make a backup.
Here are my questions:
- Is there any way how to find out how many directories (not files) have been created/deleted in the source directory since last backup?
- How can I find out how many files have been deleted in the source directory since last backup?
There is no need to use rsync for this. I'm fine with other tools to be used. I'm just looking for simple and fast way to do this.