Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i would like to know how to get all single .bak (or anyother extension) files into a directory, and zipping them (one by one) and save them using the same name, changing only extension.


share|improve this question
Going to need more information than that, or clarify the question. What do you mean by "all single files into a directory" and from where? –  Nixphoe Jun 18 '12 at 15:19
Suppose i have a directory with 100 bak files: i would like to zip all 100 files (into 100 different zip archive). –  stighy Jun 18 '12 at 15:20
SvenW: the first one.. file1.bak into file1.zip, file2.bak into file2.zip –  stighy Jun 18 '12 at 15:20

1 Answer 1

For unixoid systems, see this.

On Windows, try something like this in cmd.exe:

for %f in (*.bak) do zipper_software %f %f.zip 

The exact syntax for this command will depend on the zip software you use. Note that you likely will end up with archive file names like file1.bak.zip.

share|improve this answer
This was what I was going to suggest, but kudos for this answer. –  Ash Jun 18 '12 at 15:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.