copying files

i have a folder called FLORIDA and in that folder i have all the user home folders.

within the home folders are .pst files.

how can i copy all the .pst files and keeping the same folder structure?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Christopher RourkeProduct Manager @ Experts ExchangeCommented:
I think you're looking for the xcopy command. Here's a link to a recent article explaining the command syntax which also provides a couple use examples:
robocopy is the tool to use.
This will copy all .pst files found under "D:\Florida" to "E:\Whatever", keeping the folder structure (note that the target folder will be the final target folder with the source folder's content - in this example, there will be no folder "Florida" created under "Whatever"!).
If you want to copy the NTFS permissions as well, use "/copy:DATSOU" (Security, Owner, aUdit) instead of "/copy:DAT"
robocopy.exe "D:\Florida" "E:\Whatever" *.pst /s /copy:DAT /r:0 /log:"C:\Temp\pst_copy.log"

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob KnightConsultantCommented:

try xcopy [SourceFilePath]\*.pst [DestinationFilePath] /s

Kind regards,

Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

ttrbrtsnAuthor Commented:
rob, i ran your script. however, it failed when it found a pst opened by outlook. how can i bypass locked  files?
Bill PrewIT / Software Engineering ConsultantCommented:
If a PST file is currently opened you really don't want to copy it, since the data is likely to be in an unstable state, and may be corrupted if you tried to use it later.  ROBOCOPY might be the better option, I think it allows skipping opened files.

Rob KnightConsultantCommented:
ivan rosaCommented:
Have you tried to copy the file while in safe mode with network support?
worst case you could also use a linux distro such Ubuntu and copy from there... or also a WINpe, as long the HDD is not encrypted...
even if that fails again then your host HDD might be corrupted...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.