Solved

Copy / Xcopy - Need to copy specific files within folders

Posted on 2013-02-06
6
784 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 53

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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 54

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 84

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

730 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