I haven't been able to find the answer to this one. I have tried all kinds of combinations of
--delete-excluded, and source directory.
This is what I'm trying to accomplish:
Dir1/File1-1 Dir1/File1-2 Dir2/File2-1 Dir2/File2-2 Dir2/File2-3 Dir3/File3-1 Dir3/File3-2 Dir3/File3-3 ...
What I would like to do is to provide a pre-defined subset of files from the source directory with the relative path and rsync them to the remote destination, deleting anything on the destination (including directories) that wasn't in the subset of files.
For example, given the above Source Directory:
My Pre-defined File List:
Dir1/File1-1 Dir1/File1-2 Dir2/File2-1 Dir3/File3-1
I would expect to have only Dir1/File1-2, Dir3/File3-3, and no Dir2 in the destination when I'm done. I will also NOT have expected Dir1/File1-2 to be copied over again.
Things to Note:
- These are very large files and I'm trying to prevent having to remotely copy them again if not needed.
- The contents of the source sub-directories changes everyday
- The pre-defined list changes everyday, but may/will include files in yesterday's list
- There are 0 files in the Source Directory. It only contains sub-directories which contain the files needed to sync
- The Sub-directories in the Source are pretty static. i.e. Dir1, Dir2 and Dir3 will always be there
I will keep plugging away to see if I can come up with the solution I'm looking for.
First of all, I want to thank jw013 for the formatting changes. I followed the help guideline, but didn't understand why is wasn't formatting correctly (first time poster).
Using the suggestions from Serge, I came up with the following command, but it still does not remove the extraneous files from the destination that are NOT in the File List.
rsync -avRP --prune-empty-dirs --delete-delay --ignore-existing $FILE_LIST destination/