Sign in to follow this  
Followers 0
Otte

Zip Files accoring to date

3 posts in this topic

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

Share this post


Link to post
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)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0