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

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:
Rob KnightConsultantCommented:

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

Kind regards,

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 PrewCommented:
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...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.