Home Page - 2003-07-27
Post date: Nov 29, 2008 4:20:57 AM
Zip Anywhere [Read this article]
...Then it struck, Why not zip each folder before burning the CD ?! This was indeed a good solution, as it elides both my long file name problem, and the deep folder problem. In fact, from then on it has become a constant practice to zip before archiving into a CD. Of course, it is prudent to have small zips, so make lot of root level folders, instead of sub folders (usually I prefix the grouping name for the flattened folders, ...).
Recursively iterating over the file system is pretty simple and an useful task. This is possible as Java treats both a file and a folder as a java.io.File... Zipping a file involves two steps: One, to put a zipentry, which is just the destination file path to be recorded inside the zip file (you can play tricks here!).
...For a long time I was procrastinating to write this tool. But when Venu asked for a neat task that can be useful, I gave this. Venu, though a new comer to Java (hardly two months now), but since he was strong in C++, completed this tool within few days, working just in his spare time. Thanks to him, this article and the zip tool is before you.