Discussion Locked

XCOPY Batch File

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello. I work for a non-profit charity organization that has no servers; rather is using a Microsoft peer-to-peer network. Moving forward in small steps, I am now using an XP machine to be the "server." At present, we have no external backup device, so I have to manually copy (UGH) certain key files and directories to another quiet workstation that has little user intervention (the print "server") so at least the files/docs will be in 2 places instead of only one should I be so unfortunate as to lose my data.

What I'd like to do is use a batch file to automate the process, but I'm a little uncertain as to what syntax to use:

a) In order to copy from \\mycomputer\directory\file to \\thatcomputer\directory\file [using UNC]

b) To allow the destination files be overwritten without user intervention -- to answer Y or N automatically, and lastly

c) To set up an automated process to run this batch file after hours.

Thanks!

5 replies

by joseph moore

To use XCOPY to copy with some good switches, try this:

xcopy c:\directory\*.* \\thatcomputer\directory /E /C /I /Q /H /K /O /X /Y

Those are the switches for XCOPY I recommend using. The say to overwrite and same-named destination files with these newly copied ones, do not ask to overwrite the files just do it, create any directory structures needed, do not display anything on the screen when the copy is going on, copy over file attribute info (if read-only, etc).
The one switch you might want to not include is the /O which says to copy over ACL information. Since you are on a peer-to-peer network, you probably don't want that option set.

Now, just make a .BAT file with the XCOPY line, save the file on your XP system. Put in the files/directories you want to copy over in the XCOPY line(s) and the proper destination locations.
Then open up Scheduled Jobs on the XP box, and build a scheduled job to run the BAT file.

hope this helps.

by mphoffar

Your batch file would probobly want to start out with

NET USE S: \\mycomputer\directory
NEt USE T: \\thatcomputer\directory

Then you could do a

xcopy /y /s s:\ t:\ (or whatever way you're going)

the /y will answer Y for the overwritethe /s will copy subdirectories and their contents (if any)

And to time it. I'd just drop it in the scheduled tasks

Mark

This discussion is closed to new replies.