Solved

MS-DOS xCopy with Windows XP Pro

Posted on 2006-11-25
6
1,119 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
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.

777 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