![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject[>>] [<<]Thread[>>]
Number : 8006 Date : 2004-06-06 Author : John Zeman Subject : Re: Date Switches Size(KB) : 2
I have to be out of my mind. It's a gorgeous day outside and it's Sunday so I have the day off from work, but what am I doing? I'm sitting inside playing with my computer. Oh well, at least I have the window next to me open. This topic appears to have been pretty well exhausted by now, but I've been intrigued with the concept of it. So I've done a little more experimenting this morning and have come up with yet another batch file script. By default when xxcopy copies from src to dst, it uses the current date/time when it sets the destination files creation date/time. This script uses that file created date/time to determine if it's been 7 days since the last backup. Don't let its length discourage you, the script is nearly all comments. It also may not be feasible, but it's been an interesting exercise for me so I'm posting this as general information for anyone who might be interested. :: Begin Batch File ============================= @echo off :: Examine dst file creation dates and use errorlevel to :: determine if a backup can be done later in the script. xxcopy "\dst\" /da#7/BU/L/FC > NUL :: /DA#7 Copies files with dates that are > 7 days old. :: /BU Standard backup options :: /FC Use FILE CREATED date/time instead of LAST MODIFIED :: /L List files that would be copied (no copying) :: If any files on the dst are less than 7 days old :: xxcopy returns an exit code of 0 meaning :: xxcopy would copy them if /L were removed. :: However removing /L would have undesired results as :: there is no destination specified so xxcopy would copy :: the qualifying files to whatever directory is current :: (which may be unknown) :: If no qualifying files were found xxcopy returns :: an exit code of 100 :: "if errorlevel 1" returns true for :: any errorlevel number 1 or higher :: so if no files were found to copy, then :: it's been at least 7 days since the last backup :: so do another backup if errorlevel 1 goto:dobackup echo The newest file in the destination is echo less than 7 days old. echo The batch file was aborted. pause goto:EOF :dobackup :: Put the actual xxcopy backup command line below echo xxcopy \src\ \dst\ /options pause goto:EOF :: End Batch File =============================== Ok that's it, no more geek stuff today. I'm shutting the computer down and getting my butt outside before moss starts growing on my north side. John
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.