Solved

MS-DOS xCopy with Windows XP Pro

Posted on 2006-11-25
6
1,115 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Expert Comment

by:jalilthe1
Comment Utility
0
 
LVL 1

Expert Comment

by:btomkins
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now