D:\test.txt (size 100 MB)
D:\a\b.ini (size 1 MB)
D:\z\y\x\c.pdf (size 1 GB)
E:\test.txt (size 0 bytes)
E:\a\b.ini (size 0 bytes)
E:\z\y\x\c.pdf (size 0 bytes)
Is there a way to recreate file/folder structure from source to target but without any content?
better yet, is it possible to zip it up?-vixay (June 09, 2009, 07:14 AM)
Some further thoughts. The test zip file i created has 18,375 files and weighs in at 3.27 MB. That must mean that the filenames storage takes up that much space. And that zips don't optimize that part? or something else?Indeed they don't - it would make reading the zip folder structure much slower, and to achieve any kind of reasonable compression you'd need to compress just the filenames... which would mean quite a restructure of the file format, and require either unpacking all the filename information at once, or some "somewhat interesting" code.-vixay (June 10, 2009, 07:10 AM)
Scanning for files was slower than everything/locate, i don't know how they do it, but they can scan filenames super fast. just a thought, to see if it could be sped up. Since you don't actually need to touch the file, and just need the information from the MFT.Locate builds an efficient index file, which can be read faster than the MFT (and doesn't have security-check overhead either). Everything, as far as I can tell, scans the MFT directly (which is why it requires administrator privileges).-vixay (June 10, 2009, 07:10 AM)
The date/time is not preserved for filenames. This was not an original requirement but when i think about it, it's better to have that information preserved (not required though). If it will make the program slower then it should not be there (or maybe as an optional thing).It shouldn't make the zip-creation slower, since you also get file dates when scanning for files.-vixay (June 10, 2009, 07:10 AM)
Some further thoughts. The test zip file i created has 18,375 files and weighs in at 3.27 MB. That must mean that the filenames storage takes up that much space. And that zips don't optimize that part? or something else?Yes, the filenames take up that much space. I tried it with compression and it didn't make a difference in size.-vixay (June 10, 2009, 07:10 AM)
Scanning for files was slower than everything/locate, i don't know how they do it, but they can scan filenames super fast. just a thought, to see if it could be sped up.It's not the scanning that's slow, it's the creation of all the zero-byte files that slows things down.-vixay (June 10, 2009, 07:10 AM)
The date/time is not preserved for filenames. This was not an original requirement but when i think about it, it's better to have that information preserved (not required though). If it will make the program slower then it should not be there (or maybe as an optional thing).It shouldn't make it too much slower. I'll add it in.-vixay (June 10, 2009, 07:10 AM)
Can you share your ideas on how you did it? You used IZarc to compress, did you just use flags for the command line , or dump the filename list and then create the zip?Just command-line flags (izarcc.exe -a -r -p -c0). So, the flow goes like this:-vixay (June 10, 2009, 07:10 AM)
I guess I was unclear in my Python script post, but it also adds the zero-byte files with correct modification dates >__>I just tried your script...very nice work. =]-akx (June 10, 2009, 03:10 PM)
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'
same test for the script. it failed, doesn't support unicode. :(Oopsy. Let me fix that!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'-vixay (June 10, 2009, 11:06 PM)
same test for the script. it failed, doesn't support unicode. :(Oopsy. Let me fix that!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'-vixay (June 10, 2009, 11:06 PM)
.... 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! (http://i.servut.us/i/olpzip.jpg)-akx (June 11, 2009, 11:33 AM)
Start - 06:29:44 PMIt took 7 minutes!! Out of which 5 minutes was spent just recreating the 0-byte structure! 1 minute to delete files and <1 to create the zip.
End - 06:36:41 PM
Traceback (most recent call last):
File "makeTreeZip.py", line 61, in <module>
mtime=time.localtime(os.stat(f).st_mtime)
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'J:\\Share\\Categorized Appz\\Compression Utilities\\Just Extractor\\??-readme.txt'
Traceback (most recent call last):
File "makeTreeZip.py", line 63, in <module>
mtime=time.localtime(os.stat(f).st_mtime)
ValueError: (22, 'Invalid argument')
Tuesday, September 25, 3427, 10:40:30 PMso i can see how python would choke on that. how can i resolve this issue?
bugfixes
modified time errors
path length exceeded errors
resolution:
#set time to unix epoch 0 = 'Thu Jan 01 07:00:00 1970'
so there will be some files with incorrect timestamps in the zipfile
makeTreeZip.py:32: DeprecationWarning: struct integer overflow masking is deprecated
zf.fp.write(zinfo.FileHeader())
makeTreeZip.py:32: DeprecationWarning: 'H' format requires 0 <= number <= 65535
zf.fp.write(zinfo.FileHeader())
makeTreeZip.py:79: DeprecationWarning: struct integer overflow masking is deprecated
zf.close()
makeTreeZip.py:79: DeprecationWarning: 'H' format requires 0 <= number <= 65535
zf.close()
so I can choose a temp folder located on the C root drive?You can normally do that by setting the TMP (and sometimes TEMP) environment variable to the desired location (f.e. set TMP=C:\TMP), just before starting the application. A simple batchfile could be a way to do that.-lastgasp (February 20, 2012, 03:03 AM)
Also I would like to use Zero Zipper on other peoples computers and would not be comfortable changing their temp file location folder.
Thank you everything works great now! I dropped 10 bucks in your tip jar at paypal.-lastgasp (February 29, 2012, 05:39 PM)
Looks complicated. Hmmm, where could I find this python script?-Biffle (August 16, 2016, 05:40 AM)
Thank you, vixay,
Looks complicated. Hmmm, where could I find this python script?
Many thanks again-Biffle (August 16, 2016, 05:40 AM)
Looks complicated. Hmmm, where could I find this python script?-Biffle (August 16, 2016, 05:40 AM)
Just use RoboCopy (included with Windows):
robocopy <source> <dest> /CREATE /E /np /nfl /ndl /njh /njs
It'll do it in a few seconds.-4wd (August 16, 2016, 09:31 PM)