Link to home
Start Free TrialLog in
Avatar of mcompton69
mcompton69

asked on

Xcopy: How do you NOT over write existing files (skip existing files).

I am trying to copy some files into the %SYSTEMROOT%\system32 folder.

I DO NOT want to over write any existing files (skip existing files).

I need to include this command in a batch files.  I have gone through all the xcopy commands, but there does not seem to be one, how the heck do i do this??!!!

All machines that this command will be run on are on XP.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

use robocopy instead:
http://www.ss64.com/nt/robocopy.html

/XO
ASKER CERTIFIED SOLUTION
Avatar of Timoros
Timoros
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gatelodge
Gatelodge

Or xcopy /-y which will prompt you to overwrite. Ok for a few files but if you have loads its a pain, but safe.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcompton69

ASKER

Thanks all for your help.  Sorry i can only split points between 2 of you because minimum points total is 20 so i have rewarded the 2 that are most relevent to me.
no problem, glad to assist.
had to post, this topic should have been really easy but i dont like any answers anywhere until i found below:



echo n|xcopy "source\*.*" "destination\*.*" /d/i/e

i use this to backup a folder and all subfolders but only files that do not already exist in the backup. useful for multimedia backup (ie, files themselves will never change)

it will 'ask' about overwriting an existing file but we pipe the n character to the stream and tell it to only copy files that dont already exist =)
'n' is not recognized as an internal or external command, operable program or batch file. - that's what I get when I try to "pipe the n character"


n|xcopy "\\dhssqlcc\R$\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\KinderTrack Backups\*
.bak"
concretesailors: it doesn't appear you are issuing the echo call

echo n|xcopy "\\dhssqlcc\R$\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\KinderTrack Backups\*
.bak"
oh, you are correct.
I wasn't using the echo call. Thank you.