Sunday, October 12, 2008

Tool of the Day: 7-zip

I'm in the middle of migrating from a Windows to Unix server, and I decide it's time to move the database HTML files over. Not a problem. I right mouse click on the root folder, select Send To » Compressed Folder and poof, it's off and cooking making a big 'ol zip file full of the website contents.

I come back 20 minutes later, and still chugging away. The problem is that the file tree contains a handful of video files which are humongous. Those video files were totally gumming up the works.

If this were Unix, I'd just write a quick find + zip command to leave off any video or otherwise huge files. But, this isn't Unix, it's Windows. So, what to do?

I could have installed cygwin - but that seemed a bit of an overkill. Instead, I installed 7-Zip. 7-Zip is yet another compression program. And while it has its own format, it produces .zip and .tar files, and has a handy command line version I could use.

I whipped up the following command line and in just a few seconds I had a zip file of all the pertinent files:

C:\Inetpub\vhosts\myhost.com>"c:\program files\7-zip\7z" a  \
   -r -tzip files.zip -x!*.mov -x!*.avi -x!*.wmv

This included all the .php, .html and other files, but left out the videos.

Later on, I ran the command:

C:\Inetpub\vhosts\myhost.com>"c:\program files\7-zip\7z" a  -r -ttar \
   movies.tar *.avi *.mov *.wmv

This went ahead and picked up all the videos I had left off. I specifically used the tar format, as it doesn't do any compression. That, and I'm pushing this to a Unix box anyway.

I'm sure there are plenty of good reasons to use 7-zip - add quick, unix like capabilities to the list, will you?

No comments:

Post a Comment