Link to home
Start Free TrialLog in
Avatar of techlabtest
techlabtest

asked on

Robocopy

Helo Guys,  

I need to copy a folder with different files with shared and ntfs permission to another server.  I have used this robocopy command and it doesn't work..

robocopy \\server2003\D$\Shared File Finance \\server2003new\E$ /mir

Server 2003 is my old domain controller
Shared File Finance is the shared folder with permissions
Server2003new is my new server
E is the drive when i want my shared folder ....

Please help
Avatar of oBdA
oBdA

Since the source path contains spaces, you need to enclose it in double quotes, otherwise robocopy will be unable to parse the arguments:
robocopy "\\server2003\D$\Shared File Finance" "\\server2003new\E$" /mir
Oh, and you might want to add the following options:
- /nfl and /ndl will suppress the file and folder listing of successfully copied files/folders; errors will still be logged. Having log entries for files that were successfully copied usually are of no interest and only clutter up the log
- /r:0 and /w:0, as retries in a LAN are usually unnecessary; if a copy doesn't work, it's mostly "access denied", either because the file is in use or because someone thought he's so very smart that he doesn't need his files backed up, denying admin access. Retries won't change that and will only slow down the copy (default is 1'000'000 retries with 30 seconds pause, which takes some patience).
/log:"SomeLogFile.log" to be able to check if/where errors happened, and /tee to send output to the console as well as the log file.
- /np to disable the progress indicator. If writing to a log, it's counterproductive, because it fills the log with control characters.
- /z, /b, or /zb will slow down the copy because of the additional overhead, with not much benefit in a LAN. /z is useful if copying large files over an unstable WAN connections, and /b only if the account you're using doesn't have full control over the folder tree.
Since you want file security copied as well, I suggest you add /SEC (and optionally: /SECFIX):

/SEC :: copy files with SECurity
/SECFIX :: FIX file SECurity on all files, even skipped files.
gerwinjansen is of course correct; just note that /sec copies only the DACL, not the owner or auditing settings. If you need the owner as well, use /copy:DATSO (Data, Attributes, Security, Owner), and add U (/copy:DATSOU, the same as /copyall) to copy auditing information as well.

Note that the 2003 robocopy.exe does not copy directory time stamps; if you require these, you'd need to use a machine running Vista/W2k8 or later to run the copy and add /dcopy:T to the command line.

Finally, Share permissions are not part of the file system, they're part of the LanManServer's service configuration. You can either run an export/import, or try permcopy.exe (form the W2k3 Resource Kit Tools as well).
Saving and restoring existing Windows shares
http://support.microsoft.com/kb/125996
Avatar of techlabtest

ASKER

Thanks a lot for your response but it copies only the files found in the folder Shared File Finance...
I want it to copy the whole folder with shared and security permission.....


C:\>robocopy "\\server2003\D$\Shared File Finance" "\\terminalserver\E$" /mir

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows     ::     Version XP010
-------------------------------------------------------------------------------

  Started : Mon Jun 10 13:04:04 2013

   Source : \\server2003\D$\Shared File Finance\
     Dest : \\terminalserver\E$\

    Files : *.*

  Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30

------------------------------------------------------------------------------

                           7    \\server2003\D$\Shared File Finance\
        *EXTRA Dir        -1    \\terminalserver\E$\RECYCLER\
        *EXTRA Dir        -1    \\terminalserver\E$\RECYCLER\S-1-5-21-3536306644
-2189709435-737965347-500\
          *EXTRA File                110        De22.bat
          *EXTRA File                441        De23.doc
          *EXTRA File                112        De24.bat
          *EXTRA File                110        De25.txt
          *EXTRA File                650        De26.vbs
          *EXTRA File                 56        De27.cmd
          *EXTRA File                 69        De28.txt
          *EXTRA File                 65        desktop.ini
          *EXTRA File               5620        INFO2
100%        New File                  56        Access.cmd
100%        New File                  69        New Text Document.txt
100%        New File                 110        Test.txt
100%        New File                 650        test.vbs
100%        New File                 110        test2.bat
100%        New File                 441        Test2.doc
100%        New File                 112        test3.bat

------------------------------------------------------------------------------

                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :         1         0         1         0         0         2
    Files :         7         7         0         0         0         9
    Bytes :     1.5 k     1.5 k         0         0         0     7.0 k
    Times :   0:00:00   0:00:00                       0:00:00   0:00:00

    Speed :               19846 Bytes/sec.
    Speed :               1.135 MegaBytes/min.

    Ended : Mon Jun 10 13:04:04 2013


Please help
Did you add the /S to inlcude sub folders (inc empty ones)

http://technet.microsoft.com/en-us/library/cc733145(v=ws.10).aspx
techlabtest,
* For the NTFS permissions, see gerwinjansen's comment http:#a39234017 and my comment http:#a39234049.
* For Share permissions, see my comment http:#a39234049 as well.
* For further hints on options, see my comment http:#a39233956 (I doubt that you really want to use "/R:1000000 /W:30", where a single blocked file can basically stop the whole copy operation).

TazDevil1674,
techlabtest uses /mir (see his question), which is the equivalent of /e and /purge; you can see that in the "Options" line as well.
And note that /s copies subfolders except empty ones; /e would copy subfolders including empty ones.
thanks oBdA...i tried but still i got errors... i dont know if i miss something..

Can you please write the full command?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot for your patience oBdA!!!......You solved my problem...

God bless...