Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6712285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:14:29+00:00 2026-05-26T08:14:29+00:00

How can i zip the contents of a folder using command line argument. I

  • 0

How can i zip the contents of a folder using command line argument.
I dont prefer to use 3rd party batch file.

I have a folder named “folder1” conmprising of folders 1,2,3,…
I want to zip the contents into folder1.zip file.
If i zip the folder1 , the zip file contains from folder1 .
i.e, the zip file when extracted will have folder1/folder1/(contents of the folder)
I just need to get the contents of the folder1 in the zip file.
i.e, the zip file when extracted should have folder1/(contents).
i would be happy if i can the solution in form of an ant target.

Wating for reply .

Thanks in advance.
Sachin.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:14:29+00:00Added an answer on May 26, 2026 at 8:14 am

    Why don’t you simply use the ant <zip> task for that:

    <zip destfile="${dist}/manual.zip">
      <zipfileset dir="folder1/folder1" prefix="folder1"/>
      <zipfileset dir="folder1/folder2" prefix="folder1"/>
      <zipfileset dir="folder1/folder3" prefix="folder1"/>
    </zip>
    

    This will zip the contents of the folder1/folder[1-3] directories into the directory folder1 in the example.zip file.

    EDIT: Updated to reflect the changes to the question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am opening file in binary mode using fopen(abhi.zip,rb); and reading contents from it
i have this application but how to use its? and example for 7-zip can?
I have a form where the user can upload a zip file, it works
I'm trying to create a Zip file from .Net that can be read from
I have been able to zip the contents of my folder. But I would
I have a zip file which has one base folder inside it with other
I'm executing a zip command from within my app using NSTask. It's passed as
I have a zip file whose contents are presented as byte[] but the original
I wrote a small batch file to rar all contents in all subfolders within
Hello My error is produced in generating a zip file. Can you inform what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.