DonationCoder.com Forum

Main Area and Open Discussion => General Software Discussion => Topic started by: vixay on June 09, 2009, 07:14 AM

Title: Recreate files but without content to target drive
Post by: vixay on June 09, 2009, 07:14 AM
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?

I think this will be better understood with an example.

Say if i have a source drive D: with the following

D:\test.txt (size 100 MB)
D:\a\b.ini (size 1 MB)
D:\z\y\x\c.pdf (size 1 GB)

After the zip/copy operation i want this on the target E: drive (can be another computer)

E:\test.txt (size 0 bytes)
E:\a\b.ini (size 0 bytes)
E:\z\y\x\c.pdf (size 0 bytes)

...

I was thinking that xxcopy or robocopy or some other copy utility or zip utility might have this feature but for the life of me i can't find it.

This is useful in recreating directory and file structures on which you can run various tests for finding files ...etc. and it would be easy to transfer over the internet without the size implications.
I have to do this for about 50000+ files
I've used Cathy, Locate, Everything, and i know those things are wicked fast, and they have the information i need, but then how to create a routine/plugin to create those files?

I know there is a manual way to do it, something like dump all filenames to a text file, zip it up, and then extract it, and send it through a program that will create a file for each line. But then this requires the program to exist on one end, whereas if it were a zip it would work wherever.

Sigh, i'm over thinking this. But any ideas will be appreciated.

Title: Re: Recreate files but without content to target drive
Post by: MilesAhead on June 09, 2009, 11:02 AM
I haven't used it myself, but this looks like what you mean:
http://www.rjlsoftware.com/software/utility/treecopy/default.shtml
Title: Re: Recreate files but without content to target drive
Post by: Edvard on June 09, 2009, 01:03 PM
xPlorer2 (http://zabkat.com/) will do that...

Select the folder you want to copy, then right-click -> copy.

Navigate to where you want to paste it and right-click -> Paste Special -> Folder Structure.

Done.
Title: Re: Recreate files but without content to target drive
Post by: akx on June 09, 2009, 02:15 PM
I wrote a 45-line Python (http://python.org/) script to create a contentless ZIP file that duplicates a directory structure for you :).

It's a command line script. Invoke it using "python maketree.py target-zip-file.zip mydir1 mydir2 ..." You can combine multiple trees into one zip.

Source code here (http://codepad.org/Y5AC4xcx) (public domain). If you need an .exe version, let me know.
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 09, 2009, 06:15 PM
I think everybody is missing the key element here...it's not only the folder structure the OP wants, it's all the files, too (as zero-byte files).
Title: Re: Recreate files but without content to target drive
Post by: Steven Avery on June 09, 2009, 07:04 PM
Hi Folks,

Good question.  A while back I was also thinking about this with an email program like Eudora when you want to "start fresh" with new data. You might need all the .mbx files (or whatever extension) and optionally the index or table of contents files (those would build themselves) but you want them empty to start, like they are before they receive any mail.  

Then all your mail up to that point could be saved or archived, and you can start receiving mail using the exact same filter structure. (The key point, without the empty files the filters will give errors, they do not build on the fly, although maybe in Bat-land you would have that option.)  In a rudimentary form it would be drive-to-drive (eg. c:/myfiles to d:/myfiles ) .. in a slightly more sophisticated form it would be any point-to-point. (e.g c:/myfiles to c:/newfiles/mail ).

Although it is a far less sophisticated need than the one you are mentioning, a tool would be nice, even a two step tool (tree-copy followed by "copy file to empty").

Shalom,
Steven Avery
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 01:03 AM
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?

I have this mostly done but have some questions.

1) Do you have need of the recreated zero-byte structure?  Or, do you just care about the resulting zip file?  The reason I ask is that if you don't, I'll just build the new structure in the user's temp folder and delete it when I'm done.  Make sense?

2) I currently have the zip being generated with relative paths set.  What this means is that you can unzip the resulting zip file to any folder and the structure will be built there.  Is that okay?
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 06:21 AM
Download Zero Zipper and see if this is what you had in mind.

[ You are not allowed to view attachments ]

Download: http://skwire.dcmembers.com/apps/zero_zipper/ZeroZipper.zip
Title: Re: Recreate files but without content to target drive
Post by: vixay on June 10, 2009, 07:10 AM
SkWire that's perfect!  :up: :up: And exactly what i had in mind! Pure genius! I tried it out and works. And you guys did this in less than 24 hours! Sending some credits your way.

And you are right, I needed the 0 byte files not just the folders.

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?

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.

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).

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?

Fabulous work!
Title: Re: Recreate files but without content to target drive
Post by: f0dder on June 10, 2009, 07:20 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.

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).

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.

PS: you could try zipping the generated zipfile, might be able to shave off a little of the filenames.
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 08:01 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.

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.

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.

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:

1) Recursive scan through source folder and re-create it using zero-byte files in user's temp folder.
2) Zip up temp folder with relative paths set.
3) Delete temp folder.

Does that help clear things up?
Title: Re: Recreate files but without content to target drive
Post by: mouser on June 10, 2009, 08:05 AM
make sure you exclude the temp folder from the zipping operation if the user ever tries to add all of C:
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 08:07 AM
Bahaha...the recursive spiral of doom.
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 08:21 AM
vixay, try the latest...it should keep the timestamps properly.

Download: http://skwire.dcmembers.com/apps/zero_zipper/ZeroZipper.zip
Title: Re: Recreate files but without content to target drive
Post by: f0dder on June 10, 2009, 08:32 AM
Ooooh, you use an external tool to create the zip instead of constructing it directly? No wonder it's slow then :)

(Since you're only dealing with 0-byte files, creating the zip manually from code shouldn't be that big a deal, since you only need to deal with the logical zip structure and not compression of data).
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 10:36 AM
It's not that slow.  :(  I gave it a test on a folder with 5200 files (184 folders) in it and it was done in around eight seconds.
Title: Re: Recreate files but without content to target drive
Post by: akx on June 10, 2009, 03:10 PM
I guess I was unclear in my Python script post, but it also adds the zero-byte files with correct modification dates >__>
Title: Re: Recreate files but without content to target drive
Post by: skwire on June 10, 2009, 04:29 PM
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.  =]
Title: Re: Recreate files but without content to target drive
Post by: vixay on June 10, 2009, 11:06 PM
Akx, you are right. I didn't realize it! Thanks for the script! I didn't have python installed, (doing it now), so i didn't have a quick way of trying it. I guess that means an exe would be welcome as well :P.

skwire, you should upload your webpage so that we can quickly see your apps. and regarding the speed, it is not slow, it's just that some of those nifty utilities have spoiled us with their speed, what with their scans of terabytes of data in seconds. :P

I did a test, 56 seconds for 18,736 files

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'
Title: Re: Recreate files but without content to target drive
Post by: mouser on June 10, 2009, 11:18 PM
Nice work both of you..

akx: very very cool stuff  :up:
Title: Re: Recreate files but without content to target drive
Post by: akx on June 11, 2009, 11:33 AM
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! (http://i.servut.us/i/olpzip.jpg)
Title: Re: Recreate files but without content to target drive
Post by: vixay on July 20, 2009, 10:49 PM
i had another thought that might work.
Grab list of file & folder names, and put it in text file with created/modified dates.
zip the text file. output file

on destination take output file, extract text file, create files according to text file.

This would result in a smaller file ultimately and be quicker as there are fewer disk I/O.

Actually this could be done with one utility that dumps directory structure to file, and can recreate directory structure from file. the zipping part could be manual, this way we could easily use text/excel programs to generate a desired file structure as well. I'm sure unix has a tool to do this, where you can redirect a text file to the mkdir command or something.
The problem i see with this approach is how to handle created/modified times. I guess you could output a tab delimited file.

I guess this is a tangent and just ideas. The current implementation will have a wider compatibility since it uses a standard zip file.

Title: Re: Recreate files but without content to target drive
Post by: skwire on July 20, 2009, 10:59 PM
I can easily modify Zero Zipper to do this.  In fact, it's a great idea.
Title: Re: Recreate files but without content to target drive
Post by: Brycestro on November 15, 2009, 08:43 AM
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! (http://i.servut.us/i/olpzip.jpg)

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.
Title: Re: Recreate files but without content to target drive
Post by: vixay on March 25, 2010, 07:23 AM
Ok I needed to use the utility again and decided to do the speed comparison.

I ran it on A folder with
67.8 GB (72,906,108,928 bytes)
54,824 Files, 5,364 Folders

Here's ZeroZipper
Start - 06:29:44 PM
End - 06:36:41 PM
It 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.
So this method is definitely not good for large folders.
And I think I found a bug. For the zip I didn't put a path just a name "zz.zip", the zip was created in the temp correctly but then it didn't move it to the same location as the zerozipper... it was strange... and the zip was then deleted! so I didn't get any output after waiting for so long!

I then had high hopes for the python version, as it would avoid the slow Disk I/O. So
 i finally used the py2exe and converted the code to an exe and tried that (rather than the script just to make a fair comparison).
It died again on unicode filenames :(. I did use the new version too this time!
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'

Can someone help with this problem? It seems like the filenames which contain unrecognizable characters are converted to ?? and then we we use them again it crashes... how do we retain the filenames in the original format? regardless of whether it contains Legible/illegible unicode?

After this i tried running the script directly and it seemed to work but then
I encountered another mysterious error
Traceback (most recent call last):
  File "makeTreeZip.py", line 63, in <module>
    mtime=time.localtime(os.stat(f).st_mtime)
ValueError: (22, 'Invalid argument')

I tried debugging this the value for st_mtime was 1189361328.0 i converted that using time.localtime() and it worked, so i can't figure out exactly what is causing this error.

Actually the file in question have a modified date of
Tuesday, September 25, 3427, 10:40:30 PM
so i can see how python would choke on that. how can i resolve this issue?
Title: Re: Recreate files but without content to target drive
Post by: vixay on March 25, 2010, 08:39 AM
Alright fellas,

2 hours spent trying to fix the script and here are the results for the python script!
08:25:33 PM
08:25:46 PM
a grand total of 13 seconds!!!

Zipfile about 12 MB. with 54827 files (created a few files since last count)

Things I had to fix:
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

I hope this helps everyone... though I still got some warnings while running the script... probably due to windows handling of files and or paths...
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()

Here's the final code so far
Code: Python [Select]
  1. #!/usr/bin/python
  2. import os, sys, zipfile, optparse, zlib, fnmatch, time
  3.  
  4. optp=optparse.OptionParser(usage="%prog [options] <target-zip> <source-dir> [<source-dir...>]")
  5. optp.add_option("-x", help="exclude mask", action="append", dest="exclude", default=[])
  6. optp.add_option("-q", help="be quiet", action="store_true", dest="quiet", default=False)
  7. optp.add_option("-e", help="omit empty directories", action="store_true", dest="omit_empty", default=False)
  8. err=optp.error
  9.  
  10. options, args = optp.parse_args()
  11.  
  12. if len(args)<2:
  13.   optp.print_usage()
  14.   sys.exit(1)
  15.  
  16. zf=zipfile.ZipFile(args[0], "w")
  17.  
  18. def zfAddNullFile(zf, arcname, date_time, extattr=0):
  19.   """ Adapted from the method in zipfile """
  20.   arcname = os.path.normpath(os.path.splitdrive(arcname)[1])
  21.   arcname = arcname.lstrip(os.sep + (os.altsep or ""))
  22.   zinfo = zipfile.ZipInfo(arcname, date_time)
  23.   zinfo.external_attr = extattr
  24.   zinfo.compress_type = zf.compression
  25.   zinfo.file_size = 0
  26.   zinfo.flag_bits = 0x00
  27.   zinfo.header_offset = zf.fp.tell()    # Start of header bytes
  28.   zf._writecheck(zinfo)
  29.   zf._didModify = True
  30.   zinfo.CRC = CRC = zlib.crc32("")
  31.   zinfo.compress_size = 0
  32.   zinfo.file_size = 0
  33.   zf.fp.write(zinfo.FileHeader())
  34.   zf.filelist.append(zinfo)
  35.   zf.NameToInfo[zinfo.filename] = zinfo
  36.  
  37. def printFilename(f, msg=None):
  38.   if not options.quiet:
  39.     if msg:
  40.       print msg,
  41.    
  42.     try:
  43.       print f
  44.     except:
  45.       print f.encode("charmap", "replace")
  46.  
  47. for sourceDir in args[1:]:
  48.   try:
  49.     sourceDir=sourceDir.decode("latin-1")
  50.   except:
  51.     print sourceDir
  52.     print "Exception while trying to process directory"
  53.   for dp, dn, fn in os.walk(sourceDir):
  54.     if fn:
  55.       for f in fn:
  56.         f=os.path.join(dp, f)
  57.         ok=True
  58.         for xmask in options.exclude:
  59.           if fnmatch.fnmatch(f, xmask):
  60.             ok=False
  61.             break
  62.         if ok:
  63.           try:
  64.             mtime=time.localtime(os.stat(f).st_mtime)
  65.           except ValueError:
  66.             print "Error: Modified time out of range."
  67.             printFilename(f)
  68.             print os.stat(f).st_mtime
  69.             mtime=time.localtime(0) #set time to unix epoch 0 = 'Thu Jan 01 07:00:00 1970'
  70.           except WindowsError:
  71.             print "Error: Can't find file due to windows limitations."
  72.             printFilename(f)
  73.             mtime=time.localtime(0) #set time to unix epoch 0 = 'Thu Jan 01 07:00:00 1970'
  74.            
  75.           zfAddNullFile(zf, f, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec))
  76.     elif not options.omit_empty:
  77.       mtime=time.localtime(os.stat(dp).st_mtime)
  78.       #printFilename(dp, "(empty directory)")
  79.       zfAddNullFile(zf, dp, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec), 16)
  80.      
  81. zf.close()
  82. print "All Done."

I hope you all enjoy this. I'll attach the exe as well, though I can't make any guarantees for it.

Title: Re: Recreate files but without content to target drive
Post by: skwire on March 25, 2010, 02:53 PM
Nice job, vixay.   :D
Title: Re: Recreate files but without content to target drive
Post by: feerlessleadr on April 23, 2010, 09:54 AM
Hey guys, love the software in here.  I am currently using zero zipper to create the 0 byte files but I was wondering if there were any command line options that I could use so that I could utilize zero zipper in a batch file.

I tried to use vixay's exe, but i'm not sure I completely understand how to use it.

Thanks for your help
Title: Re: Recreate files but without content to target drive
Post by: skwire on April 25, 2010, 10:15 PM
You should be able to use vixay's exe for what you want to do on the commandline like this:

makeTreeZip.exe target-zip-file.zip mydir1 mydir2

Let us know how that works out for you.
Title: Re: Recreate files but without content to target drive
Post by: skwire on October 24, 2011, 03:34 PM
Website (http://skwire.dcmembers.com/wb/pages/software/zero-zipper.php) | Download (http://skwire.dcmembers.com/apps/zero_zipper/ZeroZipper.zip)
v1.0.5 - 2011-10-24
    + Zero Zipper now preserves both the modified and created timestamps for
      files and folders within the zipfile.  (Thanks, Wayne)
    + Added drag-n-drop to the two edit fields.  (Thanks, Wayne)
    ! Fixed 120 DPI display issues.  (Thanks, Wayne)
    ! Fixed a parsing issue where not all files would get cloned into the zip.
Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 20, 2012, 03:03 AM
I have been looking for something like Zero zipper for a long time.  My goal being to create catalogs of offline drives\folders (including files!) without needing any special software to read the "catalog" - just any filemanager.   I have run into a problem though where sometimes a few dummy files are not included in the zip.  I think the problem is the 255 character limit in Windows.  Since Zero Zipper uses in my case "C:\Documents and Settings\username\Local Settings\Temp\$$$$$20120220035412_ZeroZipper_temp".

Could you add an option so I can choose a temp folder located on the C root drive?

thank you!
Title: Re: Recreate files but without content to target drive
Post by: Ath on February 20, 2012, 03:13 AM
Welcome to DonationCoder, lastgasp,

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.
Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 20, 2012, 12:18 PM
I changed the temp file as suggested and got a much better result.  Sadly I still lost some files.  The temp folder looks like this "C:\TEMP\$$$$$20120220122310_ZeroZipper_temp" .  Various test with zero zipper seem to confirm that the problem is the 255 limit.  Perhaps if "C:\TEMP\$$$$$20120220122310_ZeroZipper_temp" could be shorten to something like "C:\TEMP\Zero_temp" or even shorter it would would not skip any files.

Also I would like to use Zero Zipper on other peoples computers and would not be comfortable changing their temp file location folder.  I feel like I'm asking too much but if Zero Zipper could be revised to deal with my issues it would very much change my life.  I took a USB flash drive and formatted it to NTFS which allows Everything for Windows from voidtools.com to read the USN Journal and thus created a "dummy drive". I'm hoping to put several "dummy drives" on a single USB flash drive.  Since both Everything for Windows and Zero Zipper are portable I dream of having a complete catalog of all my drive in one USB flash.

thanks!

Title: Re: Recreate files but without content to target drive
Post by: MilesAhead on February 20, 2012, 09:05 PM
Also I would like to use Zero Zipper on other peoples computers and would not be comfortable changing their temp file location folder.

When you set an environment variable on the command line, that only lasts until you close the prompt.  Try it yourself. Open a command prompt. Type
set temp=c:\temp

then type
echo %temp%

Then exit the command prompt. Open another command prompt and type
echo %temp%

It should show the original temp directory, not c:\temp.

I just did it on Windows 7 and it still works as expected.
Title: Re: Recreate files but without content to target drive
Post by: skwire on February 22, 2012, 07:41 PM
Hi, lastgasp, and welcome to the site.  Please give this test build a try:  Zero Zipper v1.0.5.2 (http://skwire.dcmembers.com/apps/zero_zipper/ZeroZipper_.zip)

This version has a customisable temp folder setting but let me explain how it works.  You specify the folder to use and Zero Zipper will then create a folder with a really short name (basically, the first number from one that doesn't exist) and use that to create the zero-byte structure.  So, if you specify something like c:\tmp, the actual folder that will be used will be something like c:\tmp\1.  This allows me to work within a new, empty folder and easily delete it when finished zipping it.  At any rate, give this version a shot and let me know how it goes.  Thanks and sorry for the late reply.
Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 23, 2012, 12:39 PM
The customisable temp folder setting works but strangely the resulting temp.zip is always empty!  I tried different settings on four computers all resulting in an empty temp.zip.  The only exception is if I leave the temp folder setting blank\default then it creates the temp.zip correctly.  But of course this temp.zip does not contain all the files because of the 255 limit.   :(

BTW thanks for "Files 2 Folder" I love that!


Title: Re: Recreate files but without content to target drive
Post by: skwire on February 23, 2012, 04:06 PM
What are you using for the temp folder value?
Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 23, 2012, 07:50 PM
Besides "leave blank for default" I has used a couple of dozen variations including root drives.  I have tried putting temp folder on usb flash, ssd sata, and in windows 7 a RAM disk.  Except for "leave blank for default" option all produce an empty temp.zip.  I have tried changing the name from temp.zip to other names.  I have tried to put the destination zip in various places with no luck.

I have opened the the 1kb temp.zip in notepad and get this some that looks like this  PK |-   not exactly though because I ca't get the last 2 characters to copy and paste.
Title: Re: Recreate files but without content to target drive
Post by: skwire on February 25, 2012, 12:13 PM
Try this build, please:  Zero Zipper v1.0.5.5 (http://skwire.dcmembers.com/apps/zero_zipper/ZeroZipper_v1.0.5.5.zip)
Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 25, 2012, 10:11 PM
The temp.zip is working correctly now.  But I found that sometimes the file count inside the temp.zip was wrong.  Some files were still being omitted from the temp.zip. This was a mystery that I wanted to solve so I tested many folders.  Customizing the temp folder location eliminated file name length as a problem. Using Windows 7 windows explorer I found files with question marks inside of a black diamond instead of a recognizable character\number.   I searched "question mark inside of a black diamond" and I found something called a Unicode Character 'REPLACEMENT CHARACTER' .

wikipedia entry is here http://en.wikipedia.org/wiki/Unicode_Specials#Replacement_character

I mostly use a Windows Xp machine so it took a while to figure it out.

Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 26, 2012, 12:33 AM
I found a file displayed in Windows Explorer as "Rubйn Gonzбlez"  that is also skipped by zero zipper in the temp.zip.  "Rubйn Gonzбlez" should be "Rubén González" and when I correct the misspelling in Windows Explorer Zero Zipper includes it in the temp.zip with no problems.
Title: Re: Recreate files but without content to target drive
Post by: skwire on February 26, 2012, 10:05 AM
Try this build, please:  Zero Zipper v1.0.5.6 (http://skwire.dcmembers.com/apps/zero_zipper/ZeroZipper_v1.0.5.6.zip)

This one should have basic Unicode support.
Title: Re: Recreate files but without content to target drive
Post by: lastgasp on February 29, 2012, 05:39 PM
Thank you everything works great now!  I dropped 10 bucks in your tip jar at paypal.
Title: Re: Recreate files but without content to target drive
Post by: skwire on February 29, 2012, 07:18 PM
Thank you everything works great now!  I dropped 10 bucks in your tip jar at paypal.

Great to hear everything is working as requested.  Thanks very much for the donation.  I'll promote this build to v1.0.6 and release it.   :D
Title: Re: Recreate files but without content to target drive
Post by: SkyFrontier on December 09, 2012, 07:10 AM
Hi, people!
Optionally it could preserve original system attributes, too.
Is it possible to have a tick box to NOT preserve system/timestamps? (separately...)
One last thing would be having no zip at all, just the cloned directories and files at target location. Haven't tested thoroughly yet but: can target be a subfolder of source and still there will be no overlap? (initial tests say it's ok, but the real thin would be with no zip creation, I think)
Thanks!

EDIT: yes, it would be nice to have a companion txt report on target folder/along with zip file or flat clone for comparison with previous snapshots, like Brycestro said.
Title: Re: Recreate files but without content to target drive
Post by: Biffle on August 16, 2016, 04:57 AM
Can Zero Zipper do this "Recreate files but without content to target drive" without zipping the files, but just create them in the target (so one would not to have to unzip them each time)?
Title: Re: Recreate files but without content to target drive
Post by: vixay on August 16, 2016, 05:30 AM
You could replace the commands to add the file to zip in the python script (see below) with your own python commands to create the file in the destination folder?
Replace these lines
zfAddNullFile(zf, f, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec))

zfAddNullFile(zf, dp, (mtime.tm_year, mtime.tm_mon, mtime.tm_mday, mtime.tm_hour, mtime.tm_min, mtime.tm_sec), 16)
with where you prepend your destination to both f & dp. e.g. f = target + f
open(f, "a").close()
os.mkdir(dp)
Though you would have to google on setting the timestamps accurately. see here  (http://stackoverflow.com/questions/1158076/implement-touch-using-python)  and here (http://stackoverflow.com/a/12654798/107537)

or use zerozipper by skwire and choose your temp directory to be the destination where you want the structure, but to prevent deletion you would have to ask skwire for the changes or the code
Title: Re: Recreate files but without content to target drive
Post by: Biffle on August 16, 2016, 05:40 AM
Thank you, vixay,

Looks complicated. Hmmm, where could I find this python script?

Many thanks again
Title: Re: Recreate files but without content to target drive
Post by: 4wd on August 16, 2016, 09:31 PM
Looks complicated. Hmmm, where could I find this python script?

Just use RoboCopy (included with Windows):

robocopy <source> <dest> /CREATE /E /np /nfl /ndl /njh /njs

It'll do it in a few seconds.
Title: Re: Recreate files but without content to target drive
Post by: vixay on August 16, 2016, 11:20 PM
Thank you, vixay,

Looks complicated. Hmmm, where could I find this python script?

Many thanks again

Here (https://www.donationcoder.com/forum/index.php?topic=18682.msg199765#msg199765)
Title: Re: Recreate files but without content to target drive
Post by: Biffle on August 24, 2016, 02:54 PM
Thank you very much, vixay!
Title: Re: Recreate files but without content to target drive
Post by: Biffle on August 24, 2016, 03:07 PM
Looks complicated. Hmmm, where could I find this python script?

Just use RoboCopy (included with Windows):

robocopy <source> <dest> /CREATE /E /np /nfl /ndl /njh /njs

It'll do it in a few seconds.

Yes, indeed, that's great, many thanks!

But it obviously doesn't work with paths containing a space or "ü", "ä", etc.
For example it does not work with:
robocopy C:\den Lw C\Vorübergehend\FileBot C:\den Lw C\Vorübergehend\test /CREATE /E /np /nfl /ndl /njh /njs

Is there a way to make it work with those characters, spaces?

Thank you very much again.
Title: Re: Recreate files but without content to target drive
Post by: 4wd on August 24, 2016, 04:30 PM
As always, you need to enclose paths with spaces in quotes, eg. "C:\this is a path"

robocopy "C:\den Lw C\Vorübergehend\FileBot" "C:\den Lw C\Vorübergehend\test" /CREATE /E /np /nfl /ndl /njh /njs
Title: Re: Recreate files but without content to target drive
Post by: Biffle on August 24, 2016, 04:43 PM
Ah yes, now it is working.

Thank you very much!