Need to make perfect copy of directory on another Drive.

Posted on 2006-11-29
Medium Priority
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

ID: 18037826
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

ID: 18037844
xcopy can copy acls.  Use xcopy /? to see the switches.
LVL 13

Expert Comment

ID: 18037859
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

LVL 13

Expert Comment

ID: 18037892
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.

LVL 13

Expert Comment

ID: 18037949

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

ID: 18037957
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 375 total points
ID: 18038044
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

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

Expert Comment

ID: 18038722
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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.

Join & Write a Comment

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

600 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