Messages - Brycestro [ switch to compact view ]

Pages: [1]
1
same test for the script. it failed, doesn't support unicode. :(
J:\Share\Programs\@Network\eToolz\Language\English.lng
Traceback (most recent call last):
  File "makeTreeZip.py", line 43, in <module>
    mtime=time.localtime(os.stat(f).st_mtime)
WindowsError: [Error 123] The filename, directory name, or volume label syntax i
s incorrect: 'J:\\Share\\Programs\\@Network\\eToolz\\Language\\Fran?ais.bmp'
Oopsy. Let me fix that!
.... There! http://codepad.org/ftWwtTGy

That version should handle
(a) zipping empty directories
(b) unicode filenames (as long as it can decode the command line...)
Picture proof here!

Hi akx,

Great script - I'm using it to replicate the file and folder structure on my hard-disk on a schedule so i can take the result and email it to myself with a little extra python scripting.  I already clone my hard-disk's contents once every week or so, but I can use this script to replicate the structure on a more regular basis (say once every 12 hours) and so when a drive does fail I can do a directory compare between the replicated structure on email and my last full clone to find out exactly what files I've completely lost, accurate to within 12 hours.  Of course this doesn't help telling me what new changes I've lost to files that did make it into my last disk clone, but it's still helpful. 

One small thing I noticed about your script is that it doesn't close off the zipfile when it's done replicating the folder/file structure.  I added the line zf.close() to mine, before adding my own logic to email it to myself.  I found myself running into problems with the email part if I didn't do this first.  I imagine that once your script is fully done it must have been closing off the zipfile implicitly and so it's not really a problem for people not adding anything to it, but thought it could be worth mentioning for anyone else who may be looking to tweak your script.

Pages: [1]
Go to full version