How do I zip all files in a directory of a given file type? - TechRepublic
Question
October 25, 2008 at 01:11 PM
webguybob

How do I zip all files in a directory of a given file type?

by webguybob . Updated 17 years, 9 months ago

Edited for clarity and after further research…

How do I zip all files in a directory, of a given file type, into their original file names + “.zip”?

…on a Windows XP machine with WinZip’s wzzip.exe command line utility installed.

Basically, I think I need a script (.bat, .vbs, .wsh) that will zip all *.log files in a directory, and have them be named after each original file name (e.g. logfile01.log.zip, logfile02.log.zip). I can either manually delete the original files after zipping, or have the batch file do so after each successful zipping. The latter would just be a bonus.

…or…even better, if possible…

A batch file that goes through a directory and converts all the files into a zip file that is named after each original file, but with a .zip extension instead of the original extension. Example: file test.txt, list.txt and play.txt can be converted into test.zip, list.zip and play.zip.

Requirements:

Must be able to be executed at a command line to affect the files in the current working directory.
Must be able to be run as a Windows Scheduled Task.

I’ve looked through all of winzip.com’s FAQs and support pages, but no dice. I’ve also googled this extensively, but only Unix solutions or third party utilities come up in the results.

This discussion is locked

All Comments