Jump to content

Zip Files accoring to date


Otte
 Share

Recommended Posts

I am trying to create a script that will automatically zip up a folder according to date, i want it to zip up the folder that is 7 days old (eg if I run it today it would zip up the folder called 20070316)

On a command line I would use this;

"C:\program files\winzip\wzzip.exe" 20070316.zip 20070316

So far in my script I have this but it doesn't work;

; This is copy of Date.au3 but changes the format to be yyyymmdd instead of yyyy/mm/dd
#include <Date-NoSlash.au3>

; Subtract 7 days from today
$sNewDate = _DateAdd( 'd',-7, _NowCalcDate())

Run('"C:\program files\winzip\wzzip.exe"' & " " & $sNewDate & '.zip' & " " & $sNewDate"" , "", @SW_MAXIMIZE)

Any help would be greatly appriciated

Otte

Link to comment
Share on other sites

  • Developers

Not sure why you created your own date include and don't know what it contains but think this will work:

; This is copy of Date.au3 but changes the format to be yyyymmdd instead of yyyy/mm/dd
#include <Date.au3>

; Subtract 7 days from today 20070316
$sNewDate = StringReplace(_DateAdd( 'd',-7, _NowCalcDate()),"/","")

Run('"C:\program files\winzip\wzzip.exe" ' & $sNewDate & '.zip ' & $sNewDate , "", @SW_MAXIMIZE)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Not sure why you created your own date include and don't know what it contains but think this will work:

; This is copy of Date.au3 but changes the format to be yyyymmdd instead of yyyy/mm/dd
#include <Date.au3>

; Subtract 7 days from today 20070316
$sNewDate = StringReplace(_DateAdd( 'd',-7, _NowCalcDate()),"/","")

Run('"C:\program files\winzip\wzzip.exe" ' & $sNewDate & '.zip ' & $sNewDate , "", @SW_MAXIMIZE)

Thanks for that, it works a treat. I created my own date include to get rid of the / but you have included it within the code which is much better.

Otte

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...