1.

Solve : backup 1x per day with XCOPY?

Answer»

Hi there...

I use XCOPY to do a backup of certain files every time my PC loads up automatically.

Is there a command I can add within my editor for XCOPY to do the backup only once per day (by checking last date executed), so that it checks if a backup has already been installed on that date / day?You would need to recreate a file in the backup directory (like flag.dat) every time you actually back up, and check the date of that file with a batch SCRIPT that runs the backup. An if-then loop checks the flag.dat creation date against the current date, and if they don't match it does the backup copy, then deletes flag.dat and creates a new flag.dat to update the date mark. Otherwise it skips the backup.Sounds like he is running the command from autoexec.bat. The easy way would be to create a seperate batch file to run the command and then use task scheduler to run the batch file at a predetermined time.'Task Scheduler' is lame. If your machine is not on when the event is scheduled, it won't execute.

A better cron utility is Kirby Alarm. This will check itself on startup and do things that were scheduled since the previous shutdown, and seems to be LESS of a resource hog than Task Scheduler. Freeware at www.kirbyfooty.com, I think that link is right.Since this is the DOS forum, if he's really running DOS, neither of these solutions will do the trick.  There are tons of old MS-DOS utilities that will allow you to check the DATES, the trick nowadays will probably be finding them.  Most of these utilities are 10 years or more old, and getting a little dusty.  For instance, here's the help screens from a little utility I've used for years, note it has several date manipulation features.


GET Version 2.6a  -   BATch File Enhancer   -   Copyright 1994 Bob Stephan
 Syntax:  GET command argument(s) /switches     More Instructions: GET.DOC
Purpose          Command Argument(s) Switches Environment ErrorLevel Extended
---------        ------- ----------- ---[/]-- --(GET=)--- --(Exit)-- --[E]---
         --------- STRING Handling and Screen I/O Commands --------
Echo             EC   "prompt"            AN   --         --          --
Get character    C[E]["prompt"][chars]    All  ASCII Char ASCII code No Echo
aNswer yes or no N[E]["prompt"][seconds]  All  ASCII Char ASCII code No Echo
Get string       S[E]["prompt"][pattern]  All  String     Length     No Echo
Put string (Zap) Z[E]["string/prompt"]    All  String     Length     StdInput
In String        #[E] "string" ['arg']    MVWX Position in string    Extract
Moving Text      T[E] "filespec" [chars]  All  ASCII Char ASCII code No Echo
Key waiting      I[E]["prompt"]           All  --Character Waiting-- Get Char
Keyboard bUffer  U[E]["chars"][num][/Wnum]MVW  [E]Locks   Length     Caps/Num
            For UE: 16=Scroll Lock, 32=Num Lock, 64=Caps Lock
'Rithmetic       R ["+-*/!="] num [/Wnum] MVWA Result     Result
Blank Screen     B[E] [New attribute]     MV   --Old attribute--     HexAttr
Video mode/bordr V[E] [New mode/color]    MV   --Old mode/color--    VGA Border
Date and Time    H[E] ["prompt"] code     All  String    Value      CatSum
 codes: 1=DoW 2=DoM 4=Mon 8=Yr 16=Hr 32=Min 64=Sec 128=odd/even 256=100ths
         --------- Disk and File Commands --------
File size[date/E]F[E] filespec[/Wdiv/X/A] MVXWA Bytes/Hex Kilobytes  Kb/10
    /W date/time codes for /E: 2=DoM 4=Mon 8=Yr 16=Hr 32=Min
Disk free space  K[E] [drive] [/Wdiv]     MVW  Kilobytes  Kb/10      Kb/100
Disk capacity    Q[E] [drive] [/Wdiv]     MVW  Kilobytes  Kb/10      Kb/100
Volume label     L[E] ["label"][drive]    MVUL Label      1=yes,0=no Match
Current dir      Y[E] [drive for Y]       MVL  Directory Level/Drive Drive:A=0
         --------- Memory and System Commands --------
Environment left E[E]                     MVX  Bytes left Bytes left Bytes/10
Memory free      M[E]                     MV   Kilobytes  Kilobytes  Kb/10
EXEC    X[E] "d:\path\program.ext" 'args' MV   Exit[Path] Exit[Drive] GETsPath
Break Flag       BR[New flag 1=on, 0=off] MV       Old flag           --
Printer(PRN)     P[E]  [test]             MVX  1=yes,0=no 1=yes,0=no Initialize
DOS Version      D[E]                     MV   Major Vers MajorMinor MinorEnv
DESQview Version DV                       MV   Major Vers MajorMinor  --
4DOS Version     4                        MV   Major Vers MajorMinor  --
Windows          4E                       MV   1=yes,0=no 1=yes,0=no  --
Coprocessor/CPU  7[E]                     MV   1=yes,0=no 1=yes,0=no CPU Type
ANSI.SYS/Model   A[E]                     MV   1=yes,0=no 1=yes,0=no PC Model
Warm/Cold Boot   W[E] ["prompt"][arg]     All  If arg:1=warm, 0=cold ColdBoot
Surrogates: }=Carriage Return, ~=Escape, Alt-255=Space/Blank.
SWITCHES: /C Ctrl-Break, /U /L case, /M Master Env, /E Enhanced keys
 /X eXtra feature, /H Hex output, /W[num] numerical value, /N No CR
 /B flush key Buffer, /TL/TR/T Trim Left/Right/Both, /Vvar=, /V- No var
 /A[nnn] Attribute ["prompt"], All bytes [F], ASCII [R]
 /S Silence, /R Return Code in Environment
See GET.DOC for additional features and BATch programming instructions.
Unregistered version, registration REQUIRED for commercial use.Thanks guys, you were all on the right track...
The best solution was 'Kirby Alarm', because I did originally intend for Task Scheduler to do just what I wanted, but an internal error regarding account information not beeing set of some sort stopped it from being able to execute (exact error: 0x80090016: key not available) ... so that freeware tool should do the trick.

I was actually using W2k, but for batch files one uses MS-DOS commands, thats what I meant.If you're running under Windows, one of my favorite script tools is AutoIt http://www.autoitscript.com/autoit3/, it's a slick utility that'll allow you to do all sorts of automation tasks.I' look for a command that can assist me in complete what I already have. It is to also place copies in four other location and here is a example of the locations these files has to copied to:

E:\xcopy Z:\staging  Z:\backup Z:\localrelease Y:\Localrelease Y:\backup F:\CA F:\TX F:\MD


echo %DATE% FILE COPY START > %3_xcopy.log
xcopy /d /e /v /c /f /h /y %1 %2 >> %3_xcopy.log
echo %DATE% FILE COPY STOP  >> %3_xcopy.log


echo ----------------- >> archive.log

echo %DATE% >> archive.log
tail -1 %3_xcopy.log >> archive.log
start notepad %3_xcopy.log
start notepad archive.logshorty, see the reference to AutoIt I posted previously.



Discussion

No Comment Found