Solved

MS-DOS xCopy with Windows XP Pro

Posted on 2006-11-25
6
1,122 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 500 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
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.

828 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