Created
September 17, 2016 20:55
-
-
Save NobleUplift/e88db90b2ff621743f0a4c4ad8e3aa37 to your computer and use it in GitHub Desktop.
Syncs mirrored AppData directory on data drive D:\Users\%USERNAME%\AppData\Roaming with %APPDATA%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
FOR %%T IN (D:\Users\%USERNAME%\AppData\Local D:\Users\%USERNAME%\AppData\Roaming D:\Users\%USERNAME%\AppData\Roaming\Microsoft\UProof) DO ( | |
SET source=%%T | |
SET destination=!source:D:\=C:\! | |
FOR /F "delims=" %%F IN ('DIR /B "%%T"') DO ( | |
IF EXIST !source!\%%F\NUL ( | |
IF NOT EXIST "!destination!\%%F" ( | |
MKLINK /J "!destination!\%%F" "!source!\%%F" | |
) ELSE ( | |
FOR %%L IN ("!destination!\%%F") DO SET attribs=%%~aL | |
IF "!attribs:~8,1!" == "l" ( | |
ECHO Folder !destination!\%%F is already linked to "!source!\%%F". | |
) ELSE ( | |
ECHO Folder !destination!\%%F exists. Please resolve. | |
) | |
) | |
) ELSE ( | |
IF NOT EXIST "!destination!\%%F" ( | |
MKLINK "!destination!\%%F" "%%T\%%F" | |
) ELSE ( | |
FOR %%L IN ("!destination!\%%F") DO SET attribs=%%~aL | |
IF "!attribs:~8,1!" == "l" ( | |
ECHO File !destination!\%%F is already linked to "!source!\%%F". | |
) ELSE ( | |
ECHO File !destination!\%%F exists. Please resolve. | |
) | |
) | |
) | |
) | |
) | |
ENDLOCAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment