Menu

7-zip including folder in zip file

JRDew
2014-04-09
2014-04-09
  • JRDew

    JRDew - 2014-04-09

    This is my first time useing 7-Zip. I think it is going to work for me but I have one issue.

    I have created a bat file where I am attempting to zip all files in a specific folder (C:\MyFiles\Test)
    But I don't want the Test folder in the zip file.
    The below code is creating Test.zip and inside Test.zip is the Test folder with all documents in the Test folder.
    I want the code to create Test.zip and inside Test.zip include only all documents in the Test folder. Not the Test folder itself.

    for %%X in (C:\MyFiles\Test) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\"

    Current:
    Test.zip
    > Test
    > 1.txt
    > 2.pdf
    > 3.pdf

    Desired:
    Test.zip
    > 1.txt
    > 2.pdf
    > 3.pdf

    Thanks

     
  • JRDew

    JRDew - 2014-04-09

    Got it...

    "c:\Program Files\7-Zip\7z.exe" a C:\MyFiles\Test.zip C:\MyFiles\Test*
    Results in:
    C:\MyFiles\Test.zip
    > 1.txt
    > 2.pdf
    > 3.pdf

    Hope this helps somebody save some time.

     
  • JRDew

    JRDew - 2014-04-09

    Got it...

    "c:\Program Files\7-Zip\7z.exe" a C:\MyFiles\Test.zip C:\MyFiles\Test*
    Results in:
    C:\MyFiles\Test.zip
    > 1.txt
    > 2.pdf
    > 3.pdf

    Hope this helps somebody save some time.

     

Log in to post a comment.

MongoDB Logo MongoDB