Solved

Copy / Xcopy - Need to copy specific files within folders

Posted on 2013-02-06
6
766 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 52

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 53

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

813 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

11 Experts available now in Live!

Get 1:1 Help Now