Microsoft > Microsoft DOS

backup 1x per day with XCOPY

(1/2) > >>

burton:
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?

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

2k dummy:
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.

MalikTous:
'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.

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

Navigation

[0] Message Index

[#] Next page

Go to full version