Need to make perfect copy of directory on another Drive.

Posted on 2006-11-29
Last Modified: 2012-06-27
I have a windows 2003 server and I need to copy a large directory/fileshare that has lots of sub directories and permissions on it.  I need to copy it to another drive and retain the permissions.  To make matters more complicated there are a bunch of files that start with ._ in there eg. ._stuff.pdf windows seems to have a problem copying these files.  I think they are from the one mac that we have connected to that drive.  some sort of utility command line or not would be great.  any ideas?
Question by:walub

Expert Comment

Comment Utility
From the server you want to copy the files TO, map a drive to the folder you want to copy.  In my example I used the Z drive as the source, and c:\folder as the destination.

Run the command:  xcopy z:\*.* c:\folder /e/g/h/k/o

/e - Copies directories and subdirectories, including empty ones
/g - will copy encrypted files even if the destination doesn't support encryption
/g - Copies hidden and system files
/k - Copies attributes
/o - Copies file ownership and ACL information

You can look at the switches for xcopy to determine if you want to add more or remove some.  Just type in xcopy /? from a command line.  Remember that it's faster to push than pull.

I've copied millions of strange files with this method and never had any problems.

Expert Comment

Comment Utility
xcopy can copy acls.  Use xcopy /? to see the switches.
LVL 13

Expert Comment

Comment Utility
try to use "robocopy"

Source options
                /S : Copy Subfolders
                /E : Copy Subfolders, including Empty Subfolders.
 /COPY:copyflag[s] : What to COPY (default is /COPY:DAT).
                      (copyflags : D=Data, A=Attributes, T=Timestamps).
                      (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).
          /COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU).
           /NOCOPY : Copy NO file info (useful with /PURGE)...

More information
LVL 13

Expert Comment

Comment Utility
ROBOCOPY.exe (from Windows Resource Kit)

The resource kit tools for XP and 2003 are also available as a free download: Windows Server 2003 Resource Kit Tools - New tools in the download include some neat group policy tools and an updated RoboCopy.
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

LVL 13

Expert Comment

Comment Utility

Robocopy will only copy a file if the source and destination have different time stamps or different file sizes. So you just use shortly time to finish the copy job.

Author Comment

Comment Utility
I get this when I try to use xcopy
"D:A PHOTO GALLERY\Event Pictures\.DS_Store
File creation error - The system cannot find the file specified.

Unable to create directory - E:\marketing\A PHOTO GALLERY\Event Pictures\Husky
1837 File(s) copied"

I have downloaded robocopy but I am not sure which switches to use.  Can someone give me the command string.  I am not copying over the network just from one drive on the server to another.
LVL 13

Accepted Solution

rhinoceros earned 125 total points
Comment Utility
You can map the network drive first,
net use p: \\Server1\reports
robocopy c:\reports p:\reports /MIR

Or find more on above web link, where has many good examples...  


:: Copy files from one server to another
ROBOCOPY \\Server1\reports \\Server2\backup *.doc /S /NP

:: List all files over 32 MBytes in size
ROBOCOPY C:\work /MAX:33554432 /L

:: Move files over 14 days old
ROBOCOPY C:\work C:\destination /move /minage:14
:: Note the MOVE option will fail if any files are open and locked.

:: The script below copies data from FileServ1 to FileServ2, the destination holds a full mirror (all files), when run regularly to synchronize the source and destination, robocopy will only copy those files that have changed (changed meaning different time stamp or different size.)


SET _source=\\FileServ1\e$\users

SET _dest=\\FileServ2\e$\BackupUsers

:: /COPYALL :: COPY ALL file info
:: /B :: copy files in Backup mode.
:: /SEC :: copy files with SECurity
:: /MIR :: MIRror a directory tree

SET _options=/R:0 /W:0 /LOG:MyLogfile.txt /NFL /NDL
:: /R:n :: number of Retries
:: /W:n :: Wait time between retries
:: /LOG :: Output log file
:: /NFL :: No file logging
:: /NDL :: No dir logging

ROBOCOPY %_source% %_dest% %_what% %_options%
LVL 13

Expert Comment

Comment Utility
you try total commader who can copy permissions. you can find it at
i too did not had any problem copying mysterious filenames in the past :)
hope that helps

Expert Comment

Comment Utility
Here's a command string for xcopy that should do the trick:

xcopy FROMdriveletter:\path\*.* TOdriveletter:\path\*.* /g /o /h /i /c /k /e /r /y

Easy to remember "go hickery"

Let me know.


Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Often we come across situations wherein our batch files would be needing to reboot Windows for a variety of reasons. A few of them would be like: (1) Setup files have been updated whose changes can take effect only after a reboot …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

17 Experts available now in Live!

Get 1:1 Help Now