# Solved: Dos Restore and backup files



## online_fixes (Jul 6, 2005)

Hello all!

I use 11 dos batch files like the following every afternoon to compare and backup changed files that I have worked with!

@echo off
echo %date% - %time% > R:\xcopy.log
xcopy "C:\Documents and Settings\Administrator\Desktop\Restore_Folder_1\*.*" R:\Restore_Folder_1\ /c /s /r /d /y /i >> R:\xcopy.log

The file wrapped when I pasted it. 

What I would like to do is Link the batch files so that as one finishes another starts? Right now I have them set up using the Task Scheduler at 30 minute intervals. On normal days the files compares and backs up any changed files in 1 or 2 minutes! 

One other question. Is there a switch that I can add that will remove folders when they are no longer in the Restore file?

Thanks!

Gary


----------



## steigrafx (Sep 27, 2005)

Have you tried making a "master" batch file that calls each of the 11 files individually?

Such as:

call file1.bat
call file2.bat
call file3.bat
etc.


----------



## blaqDeaph (Nov 22, 2005)

Or you can be a little cooler and use a For loop.

Say you named your files file1.bat to file11.bat

In a batch file, add:

FOR /L %%x IN (1,1,11) DO call file%%x.bat


----------



## online_fixes (Jul 6, 2005)

Thanks!

I will give this a try! In the actual batch file are you saying I don't need any full pathways?

Gary


----------



## blaqDeaph (Nov 22, 2005)

Put all 11 of the batch files together with the master batch file in the same directory, then all you need is 1 line:


```
FOR /L %%x IN (1,1,11) DO call file%%x.bat
```
An even cooler solution would be:


```
FOR %%x IN (*.bat) DO call %%x
```
This basically runs any .bat file, so the files can be named anything. Be aware of this, either rename the master batch file to a .cmd extension, or you'll end up with an infinite loop. Or alternativly, you can put the batch files in a sub directory of the master batch files, and change the file locations accordingly.


----------



## online_fixes (Jul 6, 2005)

Seems to be working OK with this line.
FOR /L %%x IN (1,1,11) DO call Restore%%x.bat
And I Thank You For That!

Now if I could find a switch to add to the following lines to remove files from the copies that are no longer in the orginal files. 

echo %date% - %time% >F:\xcopy.log
xcopy "C:\Documents and Settings\Administrator\Desktop\Restore_Folder_10\*.*" F:\Restore_Folder_10\ /c /s /r /d /y /i >> F:\xcopy.log

Thanks for all your help!
Gary


----------

