ROBOCOPY

by

Ik gebruikte vroeger vooral XCOPY, maar als Windows7-gebruiker ben ik ene beetje moreel verplicht ROBOCOPY te gebruiken. Voor een onnozel back-upscriptje heb ik heel lang zitten zoeken op 1 bepaalde parameter.

Synthax:
ROBOCOPY SOURCE DESTINATION /parameters

Ik wou graag een kopie nemen van de bestanden in Mijn Documenten (allez, “haar” documenten), recursief en zonder ooit iets te verwijderen.

Dit heb ik uiteindelijk genruikt.

ROBOCOPY “C:\Users\GEBRUIKERSNAAM\Documents” S:\Documenten /E /XO /XJ

Ik overloop even de parameters:

/E : ook alle onderliggende folders

/XO : exclude alle oude folders

Dit werkte voor allerlei testmappen, maar het volstond niet voor de folders “Documents”, “Pictures” of andere dingen die op NTFS-niveau gemapt worden naar een andere locatie.

Het werkte pas van zodra ik een derde paramter toevoegde om junction points te excluden.

/XJ: exclude junction points.

Ik vond een goede verklaring van dit fenomeen op de website van Microsoft.

Short answer: If you’re using Robocopy, simply using the /XJ switch will avoid this problem.

Long answer:

This recursive file structure is indeed caused by the implementation of junction points in the NTFS file structure by Microsoft. Essentially, some “folders” are not actual folders at all, but junction or reparse points, which essentially reroute a directory name to another directory. This is much like mapping a drive letter to a directory or another drive, and the Windows system is designed to handle this NTFS structure situation behind the scenes.

In Vista and 7, Microsoft decided to standardize some of the typical Windows settings for users, documents, etc., which had varied over time. To maintain backward compatibility, the old standards were also retained BUT WITH JUNCTIONS REPARSING THEM TO REDIRECT INQUIRIES INTO THE NEW ACTUAL DIRECTORIES. Most programs work right through these junctions without even noticing. For example, C:\Documents and Settings points to C:\Users. Even though the former directory does not actually exist, it APPEARS to have the files and directories under the latter, and a change in the contents of either directory will be reflected in the other, since they are in fact, a single directory.

The difficulty comes from certain Reparse Points which essentially redirect to a parent directory. This causes a recursive cascade for unwary programs or users who are unaware of the proper handling of the junctions (even though the junctions are designed to be transparent to software looking for either directory). The usual “subdirectory explosion” situation comes from the fact that the \Documents and Settings\$USER$\Application Data folder (consistent with XP convention) is a junction point in Vista to \Users\$USER$\AppData\Roaming, which in turn can contain the Application Data junction as a subdirectory…

Under normal Windows permissions, the junctions and their directories are inaccessible and hidden. If permissions are changed or programs working outside Windows are not prepared to encounter these junctions, duplication and recursion is destined to occur. For those using powerful low-level command interfaces such as Repair Console, it is best to check the capabilities and switches on the commands by using the /? help switch (for example, Robocopy /?, xcopy /?, rd /?, etc.). If you are not sure what you are doing, be sure to backup ahead of time with a reliable Windows program, with proper use of Restore Points.

Another useful discussion is here: http://www.vistax64.com/vista-general/58035-nested-application-data-directory.html

Bron: http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-infinite-loop-while-using-robocopy/20f32f0c-4cb9-4125-923d-6a57e4d27232

Hier vind je een overzicht van alle ROBOCOPY-paramters:
http://technet.microsoft.com/en-us/library/cc733145%28v=ws.10%29.aspx

Advertenties

Tags: , ,

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s


%d bloggers liken dit: