xcopy syntax issue .. I think

SmallguySmallguy Member Posts: 597
Hi I'm' trying to move over some data and keep the ntfs permssions intact

the only issue is the root folder is not being copied

example

xcopy c:\olddocs c:\newdocs /O /X /E /H /K

the issue is I want to copy the folder olddocs (to preserve the file structure) as well as it's contents but it is just copying the contents currently

I'm' sure I'm just missing a switch but can't seem to find the right combo

Comments

  • dynamikdynamik Banned Posts: 12,312 ■■■■■■■■■□
    It looks like you're supposed to use /e with /s, it doesn't look like it implies /s.

    http://technet.microsoft.com/en-us/library/bb491035.aspx

    However, it does look like /x implies /o, so you can drop that. Try: /s /e /x /h /k
  • undomielundomiel Member Posts: 2,818
    Convenient switch positioning there dynamik. :)
    Jumping on the IT blogging band wagon -- http://www.jefferyland.com/
  • dynamikdynamik Banned Posts: 12,312 ■■■■■■■■■□
    What can I say? I put the X in Xcopy ;)
  • slinuxuzerslinuxuzer Member Posts: 665 ■■■■□□□□□□
    HI, I would suggest using Robocopy you can download it for free its a microsoft tool from the windows server resource kit. This is a great tool, it will copy your ntfs permissions over provided thats what you specify, also the great thing about it is say you run it once and it finishes then you can run it later on the same directory it will recognize the changes, it will be basically a differintial transfer the second time and won't take as long.

    I used it like this when migrating a couple of servers, I would let it run over night then the next night when I was actually going to the the migration after hours I would just run the same command and then let that days changes come over (this made it to where I didn't have to stay over as long.)

    Ok so here is an example of what I do. Say I want to copy everything in the data folder from server A to Sever B.

    I will share the data folder on server A.

    Next I will map a drive on Server B to the data folder net use Z: \\serverA\data

    here is an example of my robocopy command

    C:\Migration\robocopy Z:*.* E:*.* /E /copy:DAT /R:1 /W:1 /V /FP /log+:C:\roboERROR.txt

    ( I might have the source and destination here reversed, be sure to test your commands before doing this on a production machine.)

    C:\migration\robocopy (path to exe)

    Z:*.* E:*.*

    (Source and destination *.* = all files all extensions; this tool can exclude certain extensions like .mp3, in case you don't want useless stuff being migrated; when it comes to using source and destination be SURE to test your command first one a test directory and make sure its behaving like you want, there is the potentional to overwrite your data)

    /E /copy:DAT

    (this section specifies attributes to be copied etc, I remember it being something like datsu or datsou)

    /R:1 /W:1

    (this part is important, this specifies anytime the tool encounters and error /R:1 retry one time and /W:1 specifies to wait 1 second between retrys; the default is like three retrys with 30 seconds wait; if you don't use these two switches the tool will take for ever)

    /log+:C:\roboERROR.txt

    (this speciifes the log file to be used, this is important because when the tool completes you will need to search this file with the keyword error to find out what, if any files didn't get copied over)

    One more tip, when migrating with this, make sure the NTFS permissions your trying to get copied over are not for local accounts, I had local groups applied to some of my folders with global groups nested inside the local groups, the groups were named EXACTLY the same, so some of my permissions didn't come over, not sure why this server was setup like this, but this was a pain on monday morning

    Link to Resource kit tools.

    http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
Sign In or Register to comment.