burton Posted August 13, 2004 Share Posted August 13, 2004 hiI have my backup done automatically upon each start-up with XCOPY.REM 30 sec delayREM TYPE NUL | CHOICE.COM /N /CY /TY,30 >NUL@echo offxcopy "c:\officefiles\*.*" d:\BACKUP\ /c /s /r /d /y /i > d:\BACKUP\Main\xcopy.logREM copy Outlook dataxcopy "D:\Programme\Microsoft Office\archive.pst" d:\BACKUP\Outlook /c /s /r /d /y /i >> d:\BACKUP\Outlook\xcopy.logThe above is saved as a BATCH-file (*.bat) and added to the Autostart-folder.How can Auto-It check the last backup date beforehand and if it coincides with the 'today's date' which is already saved on my harddisk, to then skip the backup?Could someone please post me the solution? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 13, 2004 Developers Share Posted August 13, 2004 hi I have my backup done automatically upon each start-up with XCOPY. The above is saved as a BATCH-file (*.bat) and added to the Autostart-folder. How can Auto-It check the last backup date beforehand and if it coincides with the 'today's date' which is already saved on my harddisk, to then skip the backup? Could someone please post me the solution? <{POST_SNAPBACK}>Write a script that: Uses the @year & @yday and check this against an inifile or registry entry if different run backup and save to this inifile or registry entry Something like this (Untested): If @YEAR & @YDAY <> INIREAD(@ScriptDir & "\my.ini","Backup","LastRun","") Then Run("yourbackup coomand) IniWrite(@ScriptDir & "\my.ini","Backup","LastRun", @YEAR & @YDAY) EndIf 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 More sharing options...
Bartokv Posted August 13, 2004 Share Posted August 13, 2004 Considering that you're using the CHOICE command, I'm assuming that you're not using Windows NT/2000. Assuming that you're not using DOS 6.22, perhaps the easiest way would be to utilize Window's Scheduler to maintain the task. (You could also code the batch file to only run once per day by placing the last-run date within a flag file.)But to answer your question, you could use a combination of FileGetTime and an assortment of the Date related macros within AutoIt to check the modification timestamp of the log file, and launch the batch file accordingly. Honestly though, if you're wanting to use some of AutoIt's functionality, you might as well just port the entire batch file into a single AutoIt script. Hope this helps. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now