Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to robocopy folder structure only (exclude files)
- Loading branch information
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
@echo off | ||
|
||
rem 65000: UTF-7 | ||
rem 65001: UTF-8 does not work on Win7 | ||
chcp 65001 > nul | ||
|
||
FOR /F "tokens=*" %%g IN ('powershell "$a='(default)'; if ( (Get-Item -Path Registry::HKCU\RCWM\rcs).property -eq $a) { echo 0 } else { echo (Get-Item -Path Registry::HKCU\RCWM\rcs).property }"') do (SET folder=%%g) | ||
|
||
IF "%folder%" == 0 ( | ||
echo Source folder not specified! | ||
echo Right-Click and select 'RoboCopy Structure'. | ||
timeout /t 3 > nul | ||
exit | ||
) ELSE ( | ||
goto start ) | ||
|
||
:start | ||
|
||
wmic process where name="cmd.exe" CALL setpriority 128 2>nul 1>nul | ||
wmic process where name="conhost.exe" CALL setpriority 128 2>nul 1>nul | ||
|
||
set curdir=%cd% | ||
|
||
IF NOT EXIST "%folder%" (echo Source folder does not exist: %folder% && timeout /t 1 >nul && echo Exiting . . . && timeout /t 2 > nul && exit ) | ||
cd /d %folder% | ||
for %%I in (.) do set fname=%%~nxI | ||
cd /d "%curdir%" | ||
|
||
IF EXIST "%fname%" ( | ||
goto :f1 | ||
) ELSE ( | ||
goto :f2 | ||
) | ||
|
||
:f1 | ||
IF EXIST "%fname%\" ( | ||
echo Folder with the same name already exists: %fname% | ||
goto :choice | ||
) ELSE ( | ||
echo File with the same name already exists: %fname% | ||
echo Cannot continue! | ||
pause | ||
exit | ||
) | ||
|
||
:f2 | ||
echo. | ||
echo Copying . . . | ||
echo. | ||
md "%fname%" | ||
robocopy "%folder%" "%fname%" /XF * /E /NP /NJH /NJS /NC /NS /MT:16 | ||
reg delete "HKCU\RCWM\rcs" /f >NUL | ||
reg add "HKCU\RCWM\rcs" /f >NUL | ||
echo Finished! | ||
timeout /t 1 1>NUL | ||
exit | ||
|
||
:choice | ||
choice /C moc /M "Merge/Overwrite/Cancel?" | ||
goto option%errorlevel% | ||
|
||
:option1 | ||
echo. | ||
echo Merging . . . | ||
echo. | ||
robocopy "%folder%" "%fname%" /XF * /E /NP /NJH /NJS /NC /NS /XC /XN /XO /MT:16 | ||
reg delete "HKCU\RCWM\rcs" /f >NUL | ||
reg add "HKCU\RCWM\rcs" /f >NUL | ||
echo Finished! | ||
timeout /t 1 1>NUL | ||
exit | ||
|
||
:option2 | ||
echo. | ||
echo Overwriting . . . | ||
echo. | ||
robocopy "%folder%" "%fname%" /XF * /E /NP /NJH /NJS /NC /NS /MT:16 | ||
reg delete "HKCU\RCWM\rcs" /f >NUL | ||
reg add "HKCU\RCWM\rcs" /f >NUL | ||
echo Finished! | ||
timeout /t 1 1>NUL | ||
exit | ||
|
||
:option3 | ||
echo Exiting . . . | ||
timeout /t 1 1>NUL | ||
exit |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Windows Registry Editor Version 5.00 | ||
|
||
;robocopy | ||
|
||
[HKEY_CLASSES_ROOT\Directory\shell\rcopys] | ||
@="RoboCopy Structure" | ||
"NoWorkingDirectory"="" | ||
"Icon"="rcwmimg.dll,-5" | ||
|
||
[HKEY_CLASSES_ROOT\Directory\shell\rcopys\command] | ||
@="cmd.exe /c chcp 65001 > nul && reg delete \"HKCU\\RCWM\\rcs\" /f > nul && reg add \"HKCU\\RCWM\\rcs\" /v \"%V\" /t REG_SZ > nul" | ||
"IsolatedCommand"="cmd.exe /c chcp 65001 > nul && reg delete \"HKCU\\RCWM\\rcs\" /f > nul && reg add \"HKCU\\RCWM\\rcs\" /v \"%V\" /t REG_SZ > nul" | ||
|
||
[HKEY_CLASSES_ROOT\Directory\Background\shell\rpastes] | ||
@="RoboPaste Structure" | ||
"Icon"="rcwmimg.dll,-6" | ||
[HKEY_CLASSES_ROOT\Directory\Background\shell\rpastes\command] | ||
@="cmd.exe /c C:\\Windows\\System32\\RCWM\\RcopyStructure.bat" | ||
"IsolatedCommand"="cmd.exe /c C:\\Windows\\System32\\RCWM\\RcopyStructure.bat" | ||
|
||
; end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Windows Registry Editor Version 5.00 | ||
|
||
;Remove RoboCopy from context menu | ||
|
||
[-HKEY_CLASSES_ROOT\Directory\shell\rcopys] | ||
|
||
[-HKEY_CLASSES_ROOT\Directory\Background\shell\rpastes] | ||
|
||
; end |