Solved

Need to make perfect copy of directory on another Drive.

Posted on 2006-11-29
9
867 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
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.
0
 
LVL 4

Expert Comment

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

Expert Comment

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

Expert Comment

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

http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en
0
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

by:rhinoceros
Comment Utility
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
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.
0
 
LVL 13

Accepted Solution

by:
rhinoceros earned 125 total points
Comment Utility
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
Comment Utility
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
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.

Smak
0

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 (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). 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