Solved

Copy / Xcopy - Need to copy specific files within folders

Posted on 2013-02-06
6
741 Views
Last Modified: 2013-02-06
I have a file called DBStart.mdb, that has different versions stored within seperate subfolders on my D: drive (D:\DBSTart Master).  I need to copy all of these files into a new folder called "D:\DBSTart backup", with the folder structures still in tact.

I do need to automate this, which was why I was thinking of using the XCopy / Copy command, but cannot remember the syntax.

Thanks for any help.
0
Comment
Question by:Andy Brown
6 Comments
 
LVL 16

Expert Comment

by:uescomp
ID: 38859670
Probably something like:

xcopy "D:\DVSTart Master" "D:\DBStart backup" /e /c /h /r /y /z
0
 
LVL 19

Expert Comment

by:strivoli
ID: 38859676
Consider RoboCopy as well. Much better than xcopy/copy.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 38859762
You may see the syntax of the all commands with the /? parameter, as in:

copy /?
xcopy /?
robocopy /?

I did the above and piped the output to a text file, then into a Word file, then a PDF, which is attached for you. Regards, Joe
copy-xcopy-robocopy-syntax.pdf
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 38859996
I think you should be able to do this to just get those files:

xcopy /S /I "D:\DBSTart Master\DBSTart.mdb" "D:\DBSTart backup"

Open in new window

~bp
0
 
LVL 83

Expert Comment

by:oBdA
ID: 38860038
Use robocopy.exe; it's more robust than copy/xcopy. Basic command to use:
robocopy.exe "D:\DBStart Master" "D:\DBStart backup" DBStart.mdb /s /r:2 /w:2
Note that
- robocopy will by default only copy files that don't exist in the same version in the target yet, so if you run it several times, it will not re-copy the files already backed up.
- If you want your backup to look exactly like your source folder (that is, if you delete a file/folder in the source, it will be deleted in the backup folder again), add /mir to the options. Might ot might not be useful for automation, depending on your requirements.
- If you want a log file (useful for automation), add /tee /np /log+:"C:\Temp\DBStartBackup.log" /tee to the options. /np disables the progress indicator, otherwise the progress indicator fills the log with control characters.
robocopy comes with Windows since Vista/W2k8, for XP/W2k3, it's part of the Resource Kit:
Windows Server 2003 Resource Kit Tools
http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
0
 

Author Closing Comment

by:Andy Brown
ID: 38860108
Thanks guys - the XCopy code was perfect.

Thank you.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

746 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

15 Experts available now in Live!

Get 1:1 Help Now