Last active
August 29, 2015 14:23
-
-
Save jatubio/ce97f6f663cdcab6ecbf to your computer and use it in GitHub Desktop.
Compare directories first level names
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 | |
SET DestinationDrive=Z | |
SET TotalDuplicated=0 | |
call :source "%~1" | |
rem echo source set to %source% from %~1 | |
call :destination "%~2" %source% | |
rem echo destination set to %destination% from %~2 and %source% | |
echo Comparing %source% with %destination% | |
if "%source%"=="" ( | |
echo El origen está vacío | |
goto :EOF | |
) | |
if "%destination%"=="" ( | |
echo El destino está vacío | |
goto :EOF | |
) | |
echo. | |
echo No Duplicados | |
for /D %%a in ("%source%\*.*") do call :unique "%%a" %destination% | |
echo. | |
echo. | |
echo Duplicados | |
for /D %%a in ("%source%\*.*") do call :duplicated "%%a" %destination% | |
echo. | |
echo Total %TotalDuplicated% duplicados. | |
goto :EOF | |
:unique | |
if not exist "%~2\%~n1" echo %~n1 | |
goto :EOF | |
:duplicated | |
if exist "%~2\%~n1" echo %~n1 & set /a TotalDuplicated=%TotalDuplicated%+1 | |
goto :EOF | |
:source | |
set source=%CD% | |
IF not "%~1"=="" ( | |
set source=%~1 | |
) | |
goto :EOF | |
:destination | |
IF NOT "%~1"=="" ( | |
SET destination="%~1" | |
echo si | |
) else ( | |
set destination="%DestinationDrive%:%~pn2" | |
) | |
goto :EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To be used after cloneln.bat