![](https://seccdn.libravatar.org/avatar/ca9818dd6ceaf0a2315b89e5e16540d3.jpg?s=120&d=mm&r=g)
On 12/01/18 18:17, jdd@dodin.org wrote:
Le 12/01/2018 à 18:43, jdd@dodin.org a écrit :
If I first copy the file list in a file and give it as argument for --files-from, will --delete works?
tested, no it don't works. rsync takes the files in a from-file one at a time.
presently, the only thing I find is to blank completely the target and then, using rsync is pointless :-( (may be it's a better cp)
or is there a way to:
* compare the file list on source and target * remove files on target that where previously removed on source
the reason is that I have from time to time to clean this folder tree and I don't want to have to clean it again if I have to recover from the archives
This sound to me then, like you want to write a little script that uses hardlinks as others have suggested. So what you would do is scan the current directory for all files within the date range you want and hard-link them to your temporary directory. Then you recurse your script into all the subdirectories, linking those files. This will give you a temporary directory with all the files you want backed up. You can rsync this directory onto your card, and then delete it - because all the files have been hard-linked the files will be untouched and the directory will take up very little disk space. Incidentally, you said you sometimes have duplicate files you'd like to clean up - I've got a little utility script I run (that I got from a magazine somewhere) that finds duplicates. It's safe to run - run it over a directory and it creates two output files, one of which is a script that will delete the duplicates. All the lines in the script are commented out so you can edit it, see which files are duplicates, and delete the hash in front of the files you want to get rid of before running it. Hope it's useful... I've also got a couple of perl scripts that traverse directories like I suggested, but they don't do what you want - they would only serve as a template example. Cheers, Wol