How can I achieve this with rsync (or some other way)?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
rsync does not do that itself, but you can certainly log that ooutput, filter it for a source list, and then copy those specific files to that third location.
Sorry, the rsync command I wrote in the previous post may result in the creation of some empty directories in THIRD. The --compare-dest=SECOND option compares and excludes files only.
Why is that? To compare and exclude directories would require comparison of the entire directory hierarchy, that is, the contents of the directory with all its subdirectories. This is possible in principle, but apparently rsync does not attempt it.
Sorry, the rsync command I wrote in the previous post may result in the creation of some empty directories in THIRD. The --compare-dest=SECOND option compares and excludes files only.
Why is that? To compare and exclude directories would require comparison of the entire directory hierarchy, that is, the contents of the directory with all its subdirectories. This is possible in principle, but apparently rsync does not attempt it.
Wait. Are you saying that you think that rsync only compares one level of the source and destination path?
What makes you think that? Have you examined the rsync man page?
Are you saying that you think that rsync only compares one level of the source and destination path?
No, I am not saying that, but my wording was perhaps ambiguous enough to suggest it.
What I meant to say is that rsync with compare-dest does all of its comparing, matching, and excluding at the level of individual files. The compare-dest option does not try to compare, match, or exclude deep structures such as whole directory trees with their contents.
The typical case where such a deep comparison would be desirable is a sparse backup of just the files and directories that have changed since a previous backup. Suppose that the user requires that the sparse backup contains only those directories which have changed at any subdirectory level, and within each subdirectory, only the files that have changed. Accordingly, if a whole directory and all of its contents are unchanged since the previous backup, the whole directory should be excluded from the sparse backup.
This is what I am saying rsync can't do, or at least I haven't figured out how to do it in a single rsync command. When a whole directory and all of its contents are unchanged since the previous backup, rsync with compare-dest will create the full directory tree containing no files at any level.
If one wishes to eliminate unnecessary empty directories, it can surely be done by other means, but before we go there, the Original Poster should clarify the requirements.
The problem is that I am working with a relatively small file system that cannot hold everything, and I want to create the sparse backup somewhere else where it is isolated so I have a better view of the content and can delete files, reorganize it, etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.