[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Copy / Xcopy - Need to copy specific files within folders

Posted on 2013-02-06
6
Medium Priority
?
807 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 20

Expert Comment

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

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 58

Accepted Solution

by:
Bill Prew earned 2000 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 85

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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.
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Suggested Courses

650 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