Adding a date stamp to a zip file


Specifically I’m using 7-zip because it’s awesome.

I got the info from this website ;

Basically when you write the script, you’re pulling in parts of the date query from a command prompt and adding it to the file name you want to create.

7z a -r "%DATE:~7,2%.%DATE:~4,2%.%DATE:~-4% Backup".7z

Where you have %DATE:~7,2%  this is basically saying from the DATE request, start at character 7 and use the next two characters. So where DATE might produce something like;    Thur  11/04/2010    as in their example, it would in fact copy “04” from that  because it starts at character 7 which is / and then uses the next two characters, namely 04.

So the next bit is another DATE request and


Tags: , , ,

2 Responses to “Adding a date stamp to a zip file”

  1. Mat Says:

    I created this script for batch files that helps me with scripts to rename file to meet my date needs…

    for /F “tokens=1-4 delims=/- ” %%A in (‘date/T’) do set DATE=%%D%%C%%B
    for /F “tokens=1-4 delims=:., ” %%a in (“%TIME%”) do set TIME=%%a%%b
    mkdir e:\bob%date%

  2. tipster Says:

    Nice. Thanks Mat.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: