Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using XCopy in Dos 1

Status
Not open for further replies.

stevenr

Technical User
Feb 21, 2001
89
0
0
GB
I'm probably in the wrong place, but..
im trying to do use the date switch with xcopy to enable me to copy files that changed on a specific date to a different location, anybody know how it works?

I keep getting " Invalid number of parameters"
 
What command line are you using? If you drop to dos and type xcopy /? it will tell you the proper format and use of the command and switches. I tried using the command and had no problems. I created 2 folders on my c: drive, created a text document in one and then dropped to DOS and used Xcopy to copy the file to the second folder. The line I used was: xcopy c:\a c:\b /D:04-02-2002 (be sure not to have a space in between the : and the date, or you will get the invalid number of parameters message).

pcheather@yahoo.com

 
Ok, i had the date slash the wrong way, but now a new prob.
the code is:

xcopy N:\wgcweb\guide "C:\Development\new folder\guide\" /h /e /s /t /r /D:04-02-2002

what have i missed in order to copy files as well as folders? (the folders are hidden aswell)
 
Ok, sussed it, i was using the /t, which only copies the folders, not the files.

Thanks for your help
 
For others who may be new to using XCOPY, the /M and /A switches are worth getting familiar with. When a file gets modified, the Archive attribute gets set to A (you can see this using the ATTRIB command or from Explorer under Properties for the file). You can use this attribute to tell XCOPY to copy only those files that have changed.

Lets say you've got an empty folder. You create 10 new files in it. They will all have the "A" attribute set. Usethe command:
XCOPY /M c:\source\*.* c:\dest
All of the files will be copied and the "A" attribute cleared. Now go modify 2 of the files, and rerun the same command. Only the 2 files that changed will be copied. (The /A switch does the same thing but does NOT reset the "A" attribute).

If you're working with alot of files, this is a nice way to reduce the copy time. Put the commands in a script and you got a kind of poor-man's incremental backup. ------------------------
Doug J.
Winchester, VA
 
When using XCOPY, is there a way to copy files before a certain date rather than after a certain date? I know using the /D switch allows you to copy after a certain date, but what about before?

 
The terrific freeware XXCOPY can do this easily:

xxcopy c:\mydata\*.* d:\mydata /DB#12H ; All files 12 hours or older

xxcopy c:\mydata\*.* d:\mydata /DB#1D ; All files 1 day or older

 
Acutally.. XXCOPY is freeware for personal use only. Any corporate use slaps a 20$ per copy license after your 60 day trial period. We just did a study on all our current software in use for license fees... :) But for 20$, it's a good expense if it's only on one server.





"In space, nobody can hear you click..."
 
So it is not possible to do this with xcopy or dos alone?
 
Yes, for 20$, XXCOPY will do it (if it's for a business) and for free if it's home use.. but I'm not sure if the home version has all the features enabled...



"In space, nobody can hear you click..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top