It is currently Tue May 22, 2018 5:03 pm

looking for "universal" copy / move script

All times are UTC - 6 hours

Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Thu Apr 15, 2010 7:33 am   

Joined: Thu Apr 15, 2010 4:53 am
Posts: 1
Hi all,

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.
end for

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


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group