Solved

Need to make perfect copy of directory on another Drive.

Posted on 2006-11-29
9
876 Views
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?
0
Comment
Question by:walub
9 Comments
 
LVL 5

Expert Comment

by:megs28
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.
0
 
LVL 4

Expert Comment

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

Expert Comment

by:rhinoceros
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
http://www.ss64.com/nt/robocopy.html
0
 
LVL 13

Expert Comment

by:rhinoceros
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.

http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Expert Comment

by:rhinoceros
ID: 18037949
Advantage:

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.
0
 

Author Comment

by:walub
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.
0
 
LVL 13

Accepted Solution

by:
rhinoceros earned 125 total points
ID: 18038044
You can map the network drive first,
e.g.
net use p: \\Server1\reports
robocopy c:\reports p:\reports /MIR


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

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.)

@ECHO OFF
SETLOCAL

SET _source=\\FileServ1\e$\users

SET _dest=\\FileServ2\e$\BackupUsers

SET _what=/COPYALL /B /SEC /MIR
:: /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%
0
 
LVL 13

Expert Comment

by:stergium
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
0
 
LVL 5

Expert Comment

by:talkinsmak
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.

Smak
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Computer locks up daily 10 80
Site to Site Replication and Clustering 4 85
Daisy Chaining Scheduled Tasks in Task Scheduler 4 118
VMWare - Operating System not found 8 96
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

914 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

19 Experts available now in Live!

Get 1:1 Help Now