Jump to content

Recommended Posts

Posted

hi

I have my backup done automatically upon each start-up with XCOPY.

REM 30 sec delay

REM TYPE NUL | CHOICE.COM /N /CY /TY,30 >NUL

@echo off

xcopy "c:\officefiles\*.*" d:\BACKUP\ /c /s /r /d /y /i > d:\BACKUP\Main\xcopy.log

REM copy Outlook data

xcopy "D:\Programme\Microsoft Office\archive.pst" d:\BACKUP\Outlook /c /s /r /d /y /i >> d:\BACKUP\Outlook\xcopy.log

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?

  • Developers
Posted

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.
  :)

Posted

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. :ph34r:

Hope this helps.

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
  • Recently Browsing   0 members

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