Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ZIP
Does anyone know how to run 7zip and name the archive the current date and time like: 11012010192708.7z?
Posted 14-Aug-12 7:44am
Edited 14-Aug-12 8:43am
v2
Comments
Sergey Alexandrovich Kryukov at 14-Aug-12 12:45pm
   
Does it have anything to do with ASP.NET?
--SA
iismoove at 14-Aug-12 12:46pm
   
No
Sergey Alexandrovich Kryukov at 14-Aug-12 12:58pm
   
Then remove this tag. You are the one who is interested in tag relevance the most. I answered to your question, anyway.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You don't need to "run" 7zip. You can use 7zip library for .NET, which is a .NET wrapper around 7-zip library:
http://sevenzipsharp.codeplex.com/[^].
 
See also this CodeProject article:
C# (.NET) Interface for 7-Zip Archive DLLs[^].
 
As to the file name, you can name your files any way you want. If you need to get current time, you can use System.DateTime.Now or System.DateTime.UtcNow; please see:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^].
 
To make a string out of time, use System.DateTime.ToString(string format) with appropriate format string. Please see:
http://msdn.microsoft.com/en-us/library/zdtaw1bw.aspx[^],
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^],
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^].
 
Now you have all you need.
 
But I would not advise you to use the format you suggested. For most purposes, it's much better to use standard "sortable" format, which formats the time the way that ordering of stings by time is always the same as the files "by name" (standard alphanumerical order), which makes it very convenient to look through the files in the file managers (note that you did not ask us about setting file time, such as creation or last modification time). This format specifier is "s", highly recommended: Year-month-day"T"hours-minutes-seconds.
 
—SA
  Permalink  
v2
Comments
Abdul Quader Mamun at 14-Aug-12 13:13pm
   
greatly Answered!
 
Please read my newly posted article and plz comments or vote.
http://www.codeproject.com/Articles/440607/A-Framework-for-Software-Application
Sergey Alexandrovich Kryukov at 14-Aug-12 13:24pm
   
Thank you, Abdul.
I'll need time to look at this article...
--SA
Abdul Quader Mamun at 14-Aug-12 13:26pm
   
ok, when you will get free/time.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 359
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 14 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100