Solved

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

Posted on 2007-04-25
10
29,875 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:mcompton69
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18972079
use robocopy instead:
http://www.ss64.com/nt/robocopy.html

/XO
0
 
LVL 8

Accepted Solution

by:
Timoros earned 25 total points
ID: 18972110
Unless you use it with the /-y (Prompts to confirm that you want to overwrite an existing destination file).
As far as i know with /d[:mm-dd-yyyy] it copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.
Check out this link too:
http://www.brown.edu/Departments/Psychology/documentation/backup.html
0
 
LVL 3

Expert Comment

by:Gatelodge
ID: 18972547
Or xcopy /-y which will prompt you to overwrite. Ok for a few files but if you have loads its a pain, but safe.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Assisted Solution

by:Dark720
Dark720 earned 25 total points
ID: 18973772
IF NOT EXIST %DESTINATION% XCOPY %SOURCE% %DESTINATION%

0
 
LVL 1

Author Comment

by:mcompton69
ID: 18974201
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.
0
 
LVL 4

Expert Comment

by:Dark720
ID: 18974481
no problem, glad to assist.
0
 

Expert Comment

by:TheFunPolice
ID: 25782922
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 =)
0
 
LVL 7

Expert Comment

by:concretesailors
ID: 25843184
'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"
0
 

Expert Comment

by:TheFunPolice
ID: 25843309
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"
0
 
LVL 7

Expert Comment

by:concretesailors
ID: 25843364
oh, you are correct.
I wasn't using the echo call. Thank you.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question