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

  • SEARCH
  • Home
  • 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 6683277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:48:10+00:00 2026-05-26T04:48:10+00:00

At the moment I am using to store the zip files with the file

  • 0

At the moment I am using to store the zip files with the file name like this…

backup-20111010092345.Zip

but i want to change the file name to this ..backup-2011-10-10_09:23:45.Zip

i have got this code …

string zipName = Path.Combine(filepath, string.Format("backup-{0}.zip", DateTime.Now.ToString("yyyyMMddhhmmss")));
string backupFilePath = Path.Combine(filepath, backupName);
  using (ZipFile zip = new ZipFile())
  {
    zip.AddFile(backupFilePath, "");
    zip.Save(zipName);

  }



string backupName = "backup.sql";
 string filepath = @"C:\Folder\Back\";

would any one pls help on this…
many thanks In advance…

Modified Code:

  string zipName = Path.Combine(filepath, string.Format("backup-{0:yyyy-MM-dd_HH:mm:ss}.zip", DateTime.Now));
  string backupFilePath = Path.Combine(filepath, backupName);
  using (ZipFile zip = new ZipFile())
  {
    zip.AddFile(backupFilePath, "");
    zip.Save(zipName);

  }

Error :Notsupported Exception was unhandled

this is stack trace .

     at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
   at System.IO.File.Move(String sourceFileName, String destFileName)
   at Ionic.Zip.ZipFile.Save()
   at Ionic.Zip.ZipFile.Save(String fileName)

error: The given path’s format is not supported.

  • 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-26T04:48:11+00:00Added an answer on May 26, 2026 at 4:48 am

    Sounds like you’ve nearly got it (in terms of building the name that you specified) – you just need to change the format string

    string zipName = Path.Combine(filepath,
        string.Format("backup-{0}.zip",
                      DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss"));
    

    You could specify that as:

    string zipName = Path.Combine(filepath,
        string.Format("backup-{0:yyyy-MM-dd_HH:mm:ss}.zip",
                      DateTime.Now));
    

    It’s up to you which you find more readable.

    Note that this will use the time separator for the current culture. If you always want it to be “colon” then you should quote it. On the other hand, is colon even a valid character in Windows filenames? Consider using dash again, or something similar. For example:

    string zipName = Path.Combine(filepath,
        string.Format("backup-{0:yyyy-MM-dd_HH-mm-ss}.zip",
                      DateTime.Now));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the moment i'm using EJS template Engine but I need to convert it
Up to this moment I was using simple arrays to enter and get necessary
At moment I want to implement picture upload without using any plug-ins. My upload
I want to synchronize two threads. At the moment i am using double rotating
In my application, I'm using a database to store some data, but if I
At the moment I am using one list to store one part of my
At the moment I am using a vector to store pointers to the object
I'm using a trigger to store changes in an audit table, I only want
I want to download and parse webpage using python, but to access it I
At the moment I am using Access & an OleDb connection to store data.

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.