robocopy file/folder script for backup to 2 xbox's
#1
Is there a script that checks a specific folders on say xbox(1) and copies its contents to another xbox(2), but then only copys the changed/updated files/folders, similar to robocopy on windows?

I want to be able to have some kind mirror of data, but as the data only changes rarely, wanted a script which would occassional allow me to synchronise data of a specific folder on both xboxs (one downstairs and one in the bedroom)

I found a XBMCprep.zip script, but this only deletes and renames, I am not a python expert but would appreciate any help or guidance.

Eilz
Reply
#2
I wrote XBMCprep to "cleanup" the new builds so they did not overwrite my customizations before I FTP them to the XBOX.

For your needs, you can get a PC based FTP client (most any will work fine) to do what you want... just setup your client to FTP from one box to the other, and only overwrite if newer - one box will need to be authoritative... e.g. the "master".
I'm not an expert but I play one at work.
Reply
#3
Affini Wrote:I wrote XBMCprep to "cleanup" the new builds so they did not overwrite my customizations before I FTP them to the XBOX.

For your needs, you can get a PC based FTP client (most any will work fine) to do what you want... just setup your client to FTP from one box to the other, and only overwrite if newer - one box will need to be authoritative... e.g. the "master".

But really wanted to know if it was possible to create a script to do it without having a PC, or even some kind of hardware based ftp box.
Reply
#4
A script could be written, but i guess it could only go off file sizes. But usually if a file is changed even the slightest, the filesize will change.

Wouldn't be too hard... you should look into python.

Probably would need just a single os.walk loop that checks if a dir exists, if not then creats, then checks all the files in the dir and compares sizes, if different, then overwrites.

Also, with python, this could run in the background with a little dialog progress bar or something.

I might look into tonight.

Cheers,
Stanley87
Reply
#5
stanley87 Wrote:A script could be written, but i guess it could only go off file sizes. But usually if a file is changed even the slightest, the filesize will change.

Wouldn't be too hard... you should look into python.

Probably would need just a single os.walk loop that checks if a dir exists, if not then creats, then checks all the files in the dir and compares sizes, if different, then overwrites.

Also, with python, this could run in the background with a little dialog progress bar or something.

I might look into tonight.

Cheers,
Stanley87


Thanks, I appreciate your help. I am very new to Python scripts, so any help would be very helpful.
Thanks
Eilz
Reply
#6
I found the following links relating to RSYNC not how you would go about amending this to work within XMBC.

Python robocopier
http://aspn.activestate.com/ASPN/Cookboo...ipe/231501

rsync.py
http://www.vdesmedt.com/~vds2212/rsync.html
Reply
#7
Just yesterday I've posted asking for a simular script, just from PC to XBOX... but it would work the same way. See this thread for more info on where to get base Python code to use...
http://forum.xbmc.org/showthread.php?tid=28301
I'm not an expert but I play one at work.
Reply
#8
Hmm, i would do it like this.

You run the script and it asks you to browse for a backup location. Then you just browse to a network share (PC), another xbox etc.
Reply
#9
Rainbow 
The most efficient way to check for changes would be a checksum rather than file sizes wouldn't it - although given the potentially large data sizes involved that might be difficult and it would run a bit more slowly it need, however, only be done if the file sizes are identical....

Also modification date and time might also be useful a useful way of doing it. Combined with file size it should catch most changes. And if the files havn't really changed it isn't too much of a problem (although presents a potentially exploitable security hole without checksums....)

If filesize != previoussize:
If date!=previousdate:
**insert code for copying the files*
Reply
#10
Rainbow 
Forum took my indents out because I forgot the 'code' tag.

Code:
If filesize != previoussize:
      If date!=previousdate:
            **insert code for copying the files*
Reply
#11
K, basically done, just need to add a little GUI.
It cross checks size OR date modified.
If either are different, it will copy new file.
It also cross-checks for deleted files/
So, it keeps a excact copy of XBMC.
Will post release link soon.

PS. it was easy - took about an hour :-D
Reply
#12
Smile 
Ok, all done.

You can grab it at this link:

http://xbmc-scripting.googlecode.com/svn...Backup.zip

How To Use:

Run script, it will ask for the original/xbmc dir.
Browse to where your XBMC dir is
Then it will ask for a backup dir.
Browse to where you would like the backup of XBMC to be copied to.
And away it goes. You can do other things while the script runs in the background. You can tell when it is running when "Running" is next to the script. You can view the scripts output by going into the Python Debug screen (white button when on script).

Note: To access SMB shares, they need to be added in your XBMC Filemanager. And you need to allow the option "allow users to modify files etc" on your windows share.

Let me know how it goes, it seems pretty quick for me (faster than a FTP program)
Reply
#13
stanley87,
Nice work! Can you add a filtering feature? For those of us that mod our skin there will be files that we do not want to over write (ex: home.xml, includes.xml, etc) but may want to save on the xbox as a different name (ex: home.orig)

Can you add a feature like this for specific files and a way to exclude entire folders too?

Thanks for making this reality... it has been needed for a long time!
I'm not an expert but I play one at work.
Reply
#14
Hi Affini,

Yeh, this was just a quick little release to help a few ppl out.
Will make a propper GUI with progress bar etc and ability to have it auto backup on startup etc and a filter. Hopefully sometime this week.
Reply
#15
stanley87 Wrote:Hi Affini,

Yeh, this was just a quick little release to help a few ppl out.
Will make a propper GUI with progress bar etc and ability to have it auto backup on startup etc and a filter. Hopefully sometime this week.

Thats a million for you time working on this, can I just check one thing, will this script overwrite everything to the destination folder even if it already exists or overwrite if it is newer?
Reply

Logout Mark Read Team Forum Stats Members Help
robocopy file/folder script for backup to 2 xbox's0