Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need a batch script that will zip up all files in a particular directory and save it to another directory in a YYYY/MM/DD-HH/MM/SS format.

I've seen things similar but not sure about this.


share|improve this question

2 Answers 2

As I remember the date facilities in a batch script are tricky and limited. I made an antivirus updater script for a BartPE disk a while back and it took me quite a while to get it to be able to determine if the last update was older then a month. you may need to have the archive program input the full date/time for the file name. I am pretty sure that some of the utilitys out there will have that ability you may have to use a different program or type of archive though. If you use something like VB to do the backup it will be easier to set the date up and is not to hard to figure out for that type of a task.

also another thing to think about is if files will be locked due to use when you run the backup.

I will post the code i used in batch monday when I can look at it at work.

share|improve this answer

Here's a batch script way with WinZip. . . Just set your variable for the folders, etc, and it should work.


::Set date time variables
SET MM=%DATE:~4,2%
SET DD=%DATE:~7,2%
SET hh=%TIME: =0%
SET hh=%hh:~0,2%
SET mi=%TIME:~3,2%
SET ss=%TIME:~6,2%

:: Set directory variables
SET sourcedir=C:\Folder\Folder
SET archivedir=C:\Folder\Folder
SET archfname=%YYYY%%MM%%DD%-%hh%%mi%%ss%
SET logfile=C:\Folder\Folder\LogifleZipprocess.log

SET prgzip="C:\Program Files\WinZip\wzzip.exe"

%prgzip% -a "%archivedir%\" "%sourcedir%\*.*" >> %logfile%

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.