AMX Zip
Joe Hebert
Posts: 2,159
I?m working on an application that could potentially produce several hundred files (only a few k bytes or less each) within a couple of dozen or so subdirectories to be stored on an NI Master. I?d like to do automatic periodic offsite backups but I want to zip the entire file directory structure that the application uses and send the data as one valid zip file attachment.
Has anyone ever tried something like this or have any pointers? I?m not looking to do any compression but I do want the file to be a valid zip so that it can be opened and extracted (keeping the file directory structure in tact) without having to write a custom utility on the PC side to get to the data.
Any zip help is appreciated.
Thanks.
Has anyone ever tried something like this or have any pointers? I?m not looking to do any compression but I do want the file to be a valid zip so that it can be opened and extracted (keeping the file directory structure in tact) without having to write a custom utility on the PC side to get to the data.
Any zip help is appreciated.
Thanks.
0
Comments
I've done this on my desktop running the FileZilla server and query using the FTP MDTM command which returns the files date time stamp when it was last modified and compare that to the date time stamp I have on record in the master. Now I've only done this one way so I don't know if the master support this command. It seems all FTP servers have a slightly different lists of supported commands.
This might be a better option considering it may be impossible to zip from inside the master. You could probably do it w/ PHP but you'd be transfering the files to the PC to zip and then putting the file back on the master to transfer out and that makes no sense. At least if the master supports the MDTM command you can transfer just what's needed, normally, unzipped.
If you find a way let me know. I email client XML files to my server every month, so if their NI master ever completely dies I can get them back up with all the same user setting... this could have been a big waste of time as four years have gone by and I'm still waiting for the first master to die!
I also found that you can not email an XML file that is not in a directory. I don't know why but I thought I'd share it with you in case you try.
I think it?s very possible to do; after all it?s just a matter of creating a file on the master and dumping a bunch of data inside. The only thing I don?t know is what algorithm WinZip uses to do it. Minor detail.
I suppose I could do a manual differential backup (and may end up just doing that) but I?d prefer to create a hands free operation if at all possible.
Thanks for the heads up. I normally don?t store anything in the root directory except for keys so I should be okay there.
Thanks for the feedback guys.
If there are any WinZip wizards out there please chime in.
Jeff
http://en.wikipedia.org/wiki/Tar_(file_format)
The hardest part to implement will probably be the checksumming, which isn't too bad IMO.
Here is all of the java code I had to write to make this happen:
(I cheated and found the various zip methods already written online )
This is NOT a complete module as I still need to add the ability to extract from a zip file and a bunch of other nice things (like figuring out the correct path automatically), but it does create a zip file and it is compressed.
If anyone wants to try out the module, (WITH ABSOLUTELY NO WARRANTIES nor GUARANTEES!), let me know and I will send it your way. As soon as I a more polished module, I will post it.
Jeff