xcopy syntax

  David4637 15:50 20 Sep 2009
Locked

Could you please give me the syntax for copying some files from D:\ folder ABC and sub folder XYZ, the files are in XYZ, to say a pen drive which is defined as G:\

I tried this syntax but it did not copy

xcopy_d:\abc\xyz\*.*_g:\

underscore _ = a space in the above.

Although I want to add switches I can't even copy a few files from the D: drive to the G:\

Your help appreciated
Thanks David

  David4637 16:13 20 Sep 2009

I should have said I need to add My Docs after the d:\
I believe you have to add quotes if there is a space between My Docs?
Thanks David

  I am Spartacus 16:20 20 Sep 2009

xcopy d:\"digital photos"\*.* /S /R /Y /d:09/20/2009 e:\"digital photos"\

The above copies all files with a specified file date from the Digital Photos folder on drive d: to the folder on drive e: and includes any subfolders and read only files.

  I am Spartacus 16:22 20 Sep 2009

P.S. the /Y switch automatically overwrites any original files on drive e: without user confirmation.

  David4637 16:36 20 Sep 2009

Thanks, I will try your solution out and report back.
Thanks again David

  David4637 19:58 21 Sep 2009

I only want to copy files on the D: drive that have been modified compared to those on the G: drive (External drive).

I have used the following switches /e /h /r /y.

Using these I can copy from D: to G: even though files on the D: already exist on the G: and are exactly the same file.

What do I need to do to only copy those files that are a later version on the D: that are not on the G: ?
Your help will be much appreciated
Thanks David

  I am Spartacus 20:13 21 Sep 2009

I will be happy to be proved wrong but I don't think it's possible to do what you want with the switches in xcopy. I use the date in my batch file to only copy over those files that have been changed on or after that date.

To simplify this (sort of) I have another batch file which simply opens the backup batch file and then I do a 'Search' and 'Replace' to change the date.

  David4637 20:19 21 Sep 2009

Thanks for your help. I was thinking there is an attribute that could be changed so xcopy would know whether it had already copied or not a file to the external drive. If know one can help me I will use your date switch. Thanks again for a fast reply. David

  I am Spartacus 20:27 21 Sep 2009

If this helps I have 2 batch files. One named backup.bat which includes similar lines to the example I gave above. The other is named backedit.bat and contains the following::

cls
cd c:\
edit backup.bat

All this does is open up the backup batch file (backup.bat). I then Press Alt, S, R and enter the old date and then the new date. I then press Alt F, X and Y to confirm. As I've been using this method since 1998 it's now second nature to do it daily.

  I am Spartacus 20:28 21 Sep 2009

P.S. both batch files are in the root of the c:\ drive.

  Eric10 21:21 21 Sep 2009

xcopy d:\abc\xyz\*.* g:\ /M /Y

The M switch just copies the files where the archive attribute is set which happens when a file is saved or has been changed and re-saved. If a file is unchanged then the archive attribute is not set and the file will not be copied when the batch file is run on subsequent occasions.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

The Evil Within 2 review-in-progress

InVision Studio takes on Adobe XD and Sketch

iPhone X news: Release date, price, new features & specs

Comment transformer un iPhone en borne Wi-Fi ?