Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

creating standard .zip files with command line

Help
2014-03-26
2014-03-27
  • Mike Gravitt
    Mike Gravitt
    2014-03-26

    I'm attempting to create a batch file to archive multiple folders into separate .ZIP files. I found the below command, but wonder how to get this to create a standard .zip file instead of .7z file:

    for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" "%%X\" -mx=9 -ms=on -md=26 -mfb=256


    The information contained in this e-mail is for the exclusive use of the
    intended recipient(s) and may be confidential, proprietary, and/or
    legally privileged. Inadvertent disclosure of this message does not
    constitute a waiver of any privilege. If you receive this message in
    error, please do not directly or indirectly use, print, copy, forward,
    or disclose any part of this message. Please also delete this e-mail
    and all copies and notify the sender. Thank you.

    For alternate languages please go to http://bayerdisclaimer.bayerweb.com


     
    Attachments
    • fernando
      fernando
      2014-03-26

      try:

      for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\"
      
       
      • Mike Gravitt
        Mike Gravitt
        2014-03-27

        Thank you so much! I originally tried changing .7z to .zip, but failed to try removing switches. I presume there is not a way to control the compression level (i.e.: mx=9) with the .zip format? Thank you again.

         
        • fernando
          fernando
          2014-03-27

          review help CHM file (7-zip.chm)...
          Command Line Version > Switches > "-m (Set compression Method) switch"

          your original recipe modified -- hint: no solid ZIP archives

          for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx=9 -md=26 -mfb=256
          

          .

          unless you are a chef, just do...

          for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx
          
           
          • Mike Gravitt
            Mike Gravitt
            2014-03-27

            Thanks, Fernando!!! It worked!!! If you're ever in Pittsburgh, I owe you a beer!