I have a tricky (but - hopefully) general problem and am wondering if there is a solution somewhere:
I have my tv-recordings and so on on linux-server A (a Mediaserver). to my linux-workstation there is an USB-disk B attached. Usually I am syncing Server A to Disk B via rsync (A and B are mounted on my workstation). Now - recently - I reorganized the video-directory structure on my server A. My usually rsync-backup would now rebuild this full structure on Disk B leading to loads of redudant copies of files and - probably - a serious disk space problem.
The script I am looking for should do the following:
for every file on server A
if file does not exist on disk B: create directory-structure (if not existing) and copy file to the target directory /* leading to the same dir-structure as on source A */
if file does exist on disk B (verify by name): do not copy file but create directory structure (if not existing) and move file on disk B to new dir-structure.
Thus results would be:
- a reorganisation of files on source A in a new tree structure would yield the same tree structure on disk B with the files moved to the proper destination /* remaining an empty older dir-structure */
- new files on source A would correctly been backuped to the new tree structure (being created if necessary).
The idea is:
- avoiding heavy network traffic when reorganising dirs on source
- avoid first to delete backup, then recreate it (what if something happens in between?)
I hope, I have described my problem sufficiently - any thoughts / results / srcipts welcome
Thanks a lot