![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject [<<]Thread
Number : 7768 Date : 2004-04-26 Author : Garry Deane Subject : Re: Newbie Differential backup question Size(KB) : 3
--- In xxcopy@yahoogroups.com, "budcastle" wrote: > I am new with xxcopy so please bear with me. I mirror one > novell server to a windows server every night with a batch > file using xxcopy. The following is the batch that i use > for a differential backup, which is doing the job, but i > would like comments on what is redundant or not needed. > thanks in advance I think your batch file is generally fine but I would make a few changes. 1. I would use a few environment variables to reduce the repetition of log file naming, source and destination paths etc. This reduces the chance of mistyping a name and reduces command line length which makes it easier to read. 2. I wouldn't worry about doing a CD command since it's not needed when you fully specify the log file path. 3. Rather than renaming the log file with the date it was created, I'd simply give the log file today's date. If you're using the Pro version, you can do this simply with a date macro. For the free version, you can extract today's date elements by getting xxcopy to list the date of the current user's registry file which will always have today's date. If you want to use a fixed name for the latest log file then rename it on the next run so it is easy to spot, I'd again use xxcopy to list the date of the log file. This is because xxcopy gives an easily parsed ISO date format rather than the system dependent format returned by %%~ti. 4. Your xxcopy commands lend themselves to using a FOR loop because the only thing that changes is the source path. 5. Your xxcopy commands are very similar to the /clone command except that you are using /m instead of /bi which is the basis of /clone. Although it's a matter of taste, I prefer to use a standard command like /clone or /backup then add the particular overrides needed rather than have a long line of parameters like /e/h/r/ks. 6. I would be reluctant to use /clone (or /z) for a regular network based backup. As another user has recently posted, there can be occassional connectivity issues with network copies. If xxcopy starts running and the connection suddenly drops, you may find that all your backup files get deleted because they don't exist in the now missing source volume. I'd prefer to use /backup and have a few additional files in the backup directory than run that risk. Here's how I would re-write your batch file. Note this is mostly cosmetic - it doesn't really change how your backup commands function. @echo off setlocal if not defined c set c=c: :: Alternative 1 - requires the Pro version set log=%C%\backup\/$yyyy-mm-dd$.txt :: Alternative 2 - free or Pro version :: Get the today's date from the user registry for /f "tokens=1-3 delims=- " %%j in ( 'xxcopy "%userprofile%\ntuser.dat" /ld/zs') do ( set log=%C%\backup\%%j_%%k_%%l.txt) :: Alternative 3 - rename old backup.txt set log=%C%\backup\backup.txt if exist %log% ( for /f "tokens=1-3 delims=- " %%j in ( 'xxcopy %log% /ld/zs') do ren %log% %%j_%%k_%%l.txt ) else ( echo No Backup.txt File Exists pause ) :backup set src=\\garmen set dst=\\montville_data1 for %%a in ( sys\administration\ sys\scottc\ sys\users\ sys\urbitran\ engineering\ ) do ( xxcopy %src%\%%a %dst%\%%a /clone/pz0/b0/m/pb/oa%log%/of3/os1/od3/oe3 ) goto :eof Garry
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.