GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/JimMartinson/_Archive/CST1861/ExampleFiles/Lab04/ooga/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/JimMartinson/_Archive/CST1861/ExampleFiles/Lab04/ooga/duplicatefiles.cmd
@echo off

:: duplicatefiles.cmd
:: Written by: 
:: Written on: 

:: Test if command line extensions are enabled.
if "%~1"=="~1" goto:ExtensionsAreNotEnabled
:: Display help when the /? parameter is passed.
if NOT "%~1"=="/?" goto SkipHelp
:Help
echo Find duplicate files in different folders. Duplicates are found by name.
echo 
echo Moving (copying and deleting) the file into a newly created folder could be an option.
echo.
echo Usage: %~n0 dir1 dir2 [extention] [/m move_to_dir]
echo.
echo  dir1, dir2 = The directories to search for duplicate files.
echo   extension = Only list these file types! If nothing listed then uses *.*
echo          /m = Move older duplicate files to move_to_dir.
echo               Exact duplicates will be deleted from dir2.
echo move_to_dir = The directory to hold older duplicate files.
echo               If the move_to_dir does not exist it will be created.
echo.
goto:EOF

:ExtensionsAreNotEnabled
echo Command line extensions are not enabled. They must be enabled for %~n0 to work properly.
echo %~n0 aborted.
echo.
goto:Help

:SkipHelp
setlocal
set _filename=%~n0.txt
set _error=

:: Get dir1
set _dir1=%~1
:: Make sure that dir1 is not blank.
if NOT defined _dir1 (
	echo ERROR: dir1 not given. You must list the directories to search.
	set _error=yes
)
:: Make sure that dir1 exists.
if NOT exist "%_dir1%\" (
	echo ERROR: dir1 ^(%_dir1%^) does not exist.
	set _error=yes
)
shift
:: Get dir2
set _dir2=%~1
:: Make sure that dir2 is not blank.
if NOT defined _dir2 (
	echo ERROR: dir2 not given. You must list the directories to search.
	set _error=yes
)
:: Make sure that dir2 exists.
if NOT exist "%_dir2%\" (
	echo ERROR: dir2 ^(%_dir2%^) does not exist.
	set _error=yes
)
set _ext=
set _m=
set _moveDir=

:checkArgument
shift
if "%~1"=="" goto:continue
:: Check for extention or /m.
set _temp=%~1
if /i "%_temp%" EQU "/m" goto:getMoveDirectory
if "%_temp:~0,1%" EQU "." goto:getExtension
echo ERROR: Unknown argument (%_temp%).
set _error=yes
goto:checkArgument

:continue
if defined _error goto:EOF

echo Checking for duplicate files in directories:
echo %_dir1%
echo %_dir2%

echo Checking for duplicate files in directories:>%_filename%
echo %_dir1%>>%_filename%
echo %_dir2%>>%_filename%

:: Loop through all the files in dir1
for /f "tokens=1 delims=;" %%f in ('dir /a /one /b %_dir1%\*%_ext%') do call:testForDuplicate "%%f"

::Display the results.
start "" /wait %_filename%
del %_filename%
goto:EOF

:getExtension
if defined _ext (
	echo ERROR: Multiple extensions ^(%~1^) not allowed.
	set _error=yes
)
set _ext=%~1
goto:checkArgument

:getMoveDirectory
set _m=yes
shift
if defined _moveDir (
	echo ERROR: Multiple move to directories ^(%~1^) not allowed.
	set _error=yes
)
:: Get move_to_dir
set _moveDir=%~1
:: Make sure that _moveDir is not blank.
if NOT defined _moveDir (
	echo ERROR: move_to_dir not given. You must give the move to directory.
	set _error=yes
)
goto:checkArgument

:moveDuplicate
set _date1=%_file1:~6,4%%_file1:~0,2%%_file1:~3,2%%_file1:~18,1%%_file1:~12,5%
set _date2=%_file2:~6,4%%_file2:~0,2%%_file2:~3,2%%_file2:~18,1%%_file2:~12,5%
::echo.
::echo %_date1%
::echo %_date2%
if "%_date1%" LSS "%_date2%" (
	call:testMoveDirectory
	if defined _error goto:EOF
	move "%_dir1%\%~1" "%_moveDir%\%~1">nul
	echo Moved %_dir1%\%~1 to %_moveDir%.
	echo Moved %_dir1%\%~1 to %_moveDir%.>>%_filename%
) else (
	call:testMoveDirectory
	if defined _error goto:EOF
	move "%_dir2%\%~1" "%_moveDir%\%~1">nul
	echo Moved %_dir2%\%~1 to %_moveDir%.
	echo Moved %_dir2%\%~1 to %_moveDir%.>>%_filename%
)
::echo [%_file1%]
::echo [%_file2%]
goto:EOF

:testForDuplicate
if NOT exist "%_dir2%\%~1" goto:EOF
for /f "tokens=* delims=;" %%d in ('dir /a /t:w "%_dir1%\%~1" ^| find "%~1"') do set _file1=%%d
for /f "tokens=* delims=;" %%d in ('dir /a /t:w "%_dir2%\%~1" ^| find "%~1"') do set _file2=%%d
set _output1=%_file1:~0,38% %_dir1%\%~1
set _output2=%_file2:~0,38% %_dir2%\%~1

echo.
echo %_output1%
echo %_output2%

echo.>>%_filename%
echo %_output1%>>%_filename%
echo %_output2%>>%_filename%

if defined _m call:moveDuplicate "%~1"
goto:EOF

:testMoveDirectory
if NOT exist "%_moveDir%\" md "%_moveDir%"
if NOT exist "%_moveDir%\" (
	echo ERROR: Unable to make move to directory ^(%_moveDir%^).
	set _error=yes
)
goto:EOF

Anon7 - 2022
AnonSec Team