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 729603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:48:56+00:00 2026-05-14T06:48:56+00:00

where does DotNetZip get it’s root directory for saving. All the save examples don’t

  • 0

where does DotNetZip get it’s root directory for saving. All the save examples don’t show the directory.

My goal is to recurse a folder and subfolders. In each folder I want to zip all the files into one zip and delete the source files.

    private void CopyFolder(string srcPath, string dstPath)
    {
        if (!Directory.Exists(dstPath))
            Directory.CreateDirectory(dstPath);
        string[] files = Directory.GetFiles(srcPath);
        string msg;
        string zipFileName;
        using (ZipFile z = new ZipFile(Path.Combine(srcPath,String.Format("Archive{0:yyyyMMdd}.zip", DateTime.Now))))
        {
            z.ReadProgress += new EventHandler<ReadProgressEventArgs>(z_ReadProgress);
            foreach (string file in files)
            {
                FileInfo fi = new FileInfo(file);
                AddLog(String.Format("Adding {0}", file));
                z.AddFile(file);

            }
            //z.Save(Path.Combine(srcPath, String.Format("Archive{0:yyyyMMdd}.zip", DateTime.Now)));
            z.Save();
            if (deleteSource)
            {
                foreach (string file in files)
                {
                    File.Delete(file);
                }
            }

            zipFileName = z.Name;
        }
        if (!compressOnly)
            File.Copy(Path.Combine(srcPath,zipFileName), Path.Combine(dstPath, Path.GetFileName(zipFileName)));
        string[] folders = Directory.GetDirectories(sourcePath);
        foreach (string folder in folders)
        {
            string name = Path.GetFileName(folder);
            string dest = Path.Combine(dstPath, name);
            Console.WriteLine(ln);
            log.Add(ln);
            msg = String.Format("{3}{4}Start Copy: {0}{4}Directory: {1}{4}To: {2}", DateTime.Now.ToString("G"), name, dest, ln, Environment.NewLine);
            AddLog(msg);
            if (recurseFolders)
                CopyFolder(folder, dest);
            msg = String.Format("Copied Directory: {0}{4}To: {1}\nAt: {2}{3}", folder, dest, DateTime.Now.ToString("G"), Environment.NewLine);
            AddLog(msg);
        }
    }
  • 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-14T06:48:57+00:00Added an answer on May 14, 2026 at 6:48 am

    It’s a path relative to the current working directory, or an absolute path. This is basically standard procedure for paths.

    EDIT: The path you save to has nothing to do with directories inside the zip. Either:

    using(ZipFile f = new ZipFile("zip_dir/foo.zip"))
    {
           f.AddFile("foo.txt");
           f.Save();
    }
    

    or

    using(ZipFile f = new ZipFile())
    {
            f.AddFile("foo.txt");
            f.Save("zip_dir/foo.zip");
    }
    

    does the correct thing, namely create a zip file at ./zip_dir/foo.zip containing a single foo.txt file. Of course, you can create subdirectories in the zip, but it’s a separate issue.

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

Sidebar

Ask A Question

Stats

  • Questions 452k
  • Answers 452k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to URL encode the originalText: http://mesh.typepad.com/blog/2007/10/url-encoding-wi.html May 15, 2026 at 9:06 pm
  • Editorial Team
    Editorial Team added an answer You can use CurrentCell Property to set the CurrentRow. CurrentRow… May 15, 2026 at 9:06 pm
  • Editorial Team
    Editorial Team added an answer This is happening because CursorAdapter must have an _id column… May 15, 2026 at 9:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.