Solved

MS-DOS xCopy with Windows XP Pro

Posted on 2006-11-25
6
1,124 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
[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
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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Introduction Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like: (1) Setup files have been updated whose changes can take effect only after a reboot …
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…
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.
Suggested Courses

623 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