URGENT!!! Need Help of Copy/XCopy!

SleepyGuy

Senior member
Dec 20, 2000
588
0
0
I'm want to make a batch file that will copy all files currently on the computer to a mapped drive on the server. The thing is that, the copy should only copy files that aren't there. Ex. Computer has file 1,2,3,4,5... target drive has file 1,2,3... when i run the batch file it only copy file 4,5 to the target drive. Now imagine this with literaly thousands of files. Thanx in advance. Peace out.
 

crapito

Golden Member
Oct 20, 1999
1,225
0
81
if you find out, let me know, as I could use such a program as well. something like MS Briefcase, but between desktops, not a laptop and desktop.
 

SleepyGuy

Senior member
Dec 20, 2000
588
0
0
ok. i found out how to do it (thx a lot guys for helping! just joking!). Anyway to copy files without overwriting current files it looks like this:
xcopy x:\xxx <-source x:\xxx <-target /d /s
(psss... don't put in <-source and <-target! :))

if you are wondering /d copies in a date range but by default (which i used) it copies only files that are new or not modified. /s means to copy subdirectories in the base directory as well. I created a cool little batch file with options that allow easy user access. i still think DOS commands are kinda neat. hope this helps. peace out.
 

crapito

Golden Member
Oct 20, 1999
1,225
0
81
thanks, SleepyGuy. I'll make a batch file and try it out. I love batch files, btw, as they make repetitive little tasks much, much easier.
 

crapito

Golden Member
Oct 20, 1999
1,225
0
81
here's my sample xcopy.bat updating batch file, and an explanation of why I use what I use:

@echo off
cd\
xcopy d:\xcopy\*.* c:\temp /d /h /k /s /u /y
goto End
:End
@echo on

the echo commands are used so I don't have to see the text of the batch file while it runs, though I still get to see what files are actually copied.
the cd\ command allows the xcopy.bat file to run from the Windows Desktop as it wouldn't run correctly without it.
d:\xcopy\*.* is my original directory. the *.* part is necessary as xcopy needs files to copy in order to work.
c:\temp is the destination directory.
/d makes xcopy only copy newer versions of files that exist, rather than every single file every single time.
/h allows hidden and system files to be copied.
/k allows the attributes to be copied correctly.
/s copies (sub)directories
/u supposedly updates existing files, but I didn't notice any difference (or harm) between this command and /d.
/y eliminated the prompt before overwriting
goto End and :End may be unnecessary, but I am used to putting them in my batch files.