Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, file2.bak into – stighy Jun 18 '12 at 15:20

For unixoid systems, see this.

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

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

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

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.