# simple .bat backup script question



## dashdanw (Sep 14, 2006)

someone im working for wanted me to make a program for her so she could back up all of the information from one of her folders onto an external drive on another computer. I wrote her a little batch file that went as follows:

```
xcopy z:\*.* c:\test\*.* /s/e < a.txt
```
a.txt is just an a for *all files*. will this work as a backup? is there anything i need to add? i didnt write this myself my friend did and im not sure he really thought it out and it seems to simple to be true, but will it work as long as i setup the external drive to be shared? is there any complications anyone can think of before i go ahead and do this? there apperantly very important work related files so i dont want to mess anything up. also do i leave those *.*s in? i frgt what he told me, or did he mean those jsut stand for the file names?


----------



## mjve (May 27, 2007)

In batch an asterisk is just a wildcard for all. You need to leave them in...

I think the script looks about right, xcopy should work in this case. I'm not too sure what he's appending to a text file. 

BTW, before executing the script you should just back everything up to a CD, just incase...


----------



## dashdanw (Sep 14, 2006)

ill be sure to backup the stuff shes got on there and do a test run with some junk files, the txt file is jsut to answer to the prompt asking if hes sure he wants to copy the files (yes/no/all)


----------



## dashdanw (Sep 14, 2006)

im having a problem here, i tried to test run the batch file at my house by chanhing the z:\ to c:\nvidia (just a small file) and c:\test to d:\ so it copies to my D:\, i saved the batch and txt file to My Documents but it isnt working it just appears for a split second and dissapears. heres how i altered it:


```
xcopy c:\nvidia*.* d:\*.* /s/e < a.txt
```
and a.txt is just

```
a
```


----------



## Squashman (Apr 4, 2003)

I personally would use Karen's Replicator.
http://www.karenware.com/powertools/ptreplicator.asp


----------



## tipstir (May 23, 2005)

dashdanw said:


> im having a problem here, i tried to test run the batch file at my house by chanhing the z:\ to c:\nvidia (just a small file) and c:\test to d:\ so it copies to my D:\, i saved the batch and txt file to My Documents but it isnt working it just appears for a split second and dissapears. heres how i altered it:
> 
> 
> ```
> ...


I've had this problem too, the best way to fix this is use the copy command.

so you would go:

@echo off
c:
cd\nvidia
copy book.txt d:\backup\book.txt /y
copy book2.txt d:\backup\book2.txt /y

This is the only way it's going to work. I am at work I don't have access to the script I made on my SOHO box. Try the above on the files you want to move. If you got files that changes or gets added, then you might want to use a realy backup program XP comes with one.

If you have to move files over the network then scripts can be created to do those task.

The above can be a batch file *.bat or *.cmd (remove the @echo off)


----------



## ghostdog74 (Dec 7, 2005)

seriously, why is a.txt needed? remove a.txt and try again.


----------



## dashdanw (Sep 14, 2006)

because a.txt is the response to the prompt to continue in which the answer is y/n/a all being all files


----------



## gasyoun (Aug 3, 2007)

Not sure does The Bat Pro Office Backup plugin will help, not sure.


----------

