Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS-DOS xCopy with Windows XP Pro

Posted on 2006-11-25
6
Medium Priority
?
1,127 Views
Last Modified: 2008-01-09
Hello I have this command, it works....

xcopy "d:\My Music\*.jpg" "h:\My Music - Converted\My Music" /s /h /y

However, the problem I am having is it will go through all the files every time i run it and override it.  How can I make it so it won't copy if the file exists?  (in otherwords, not even ask)

Thanks
0
Comment
Question by:wd006451
6 Comments
 
LVL 5

Expert Comment

by:Yogalingam
ID: 18013545
The below command will ask you for the confirmation if you want to replace the existing files.

xcopy "d:\My Music\*.jpg" "h:\My Music - Converted\My Music" /s /h /-y
0
 
LVL 1

Author Comment

by:wd006451
ID: 18013555
right, but i don't want asked for it, i just don't want it to prompt about it.  Infact i don't want it to override.
0
 
LVL 7

Accepted Solution

by:
killbrad earned 2000 total points
ID: 18013659
xcopy doesn't have the ability to do this.  You could write a simple batch or vbs to do it..

You can also look into the 'archive attribute' that xcopy can use.
0
Technology Partners: 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 7

Expert Comment

by:jalilthe1
ID: 18013698
0
 
LVL 1

Expert Comment

by:btomkins
ID: 18013838
Are the files exactly the same or do they just have the same name?

If the files are exactly the same then xcopy /d option will allow xcopy work alot faster:

 xcopy "d:\My Music\*.jpg" "h:\My Music - Converted\My Music" /s /h /-y /d

(with the /d [date] switch if you dont  specify the [date] it will only copy new or updated files.)

If the files are different and only the names are the same then you will need a batch file. Copy lines below into notepad and save as "yourbatch.bat" (maake sure you select "all files" as the file type when you save the .bat)

@echo off
d:
cd "d:\My Music"
for %%f in (*.jpg) do if not exist "h:\My Music - Converted\My Music\%%f" xcopy %%f "h:\My Music - Converted\My Music\%%f"


Cheers
Brian
0
 
LVL 1

Expert Comment

by:octothorpe
ID: 18014252
try this:

  create a text file (notepad, etc) with just the letter "a" in it.  save it as somehting like "all.txt"

  then when you run xcopy, add "< all.txt" to the end of the command.  this will redirect what's in the text file to th console input just like you typed the "a" for all.

      xcopy "d:\My Music\*.jpg" "h:\My Music - Converted\My Music" /s /h /y  < all.txt

If you get multiple prompt asking if you want to overwrite, try adding more lines of "a" to the all.txt file:
  a
  a
  a
... etc.
              --- octo
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

886 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