|
|
@@ -0,0 +1,75 @@
|
|
|
+@echo off
|
|
|
+setlocal EnableExtensions EnableDelayedExpansion
|
|
|
+
|
|
|
+REM =====================================================
|
|
|
+REM getlog - RoboCopy version (Y:\ drive based)
|
|
|
+REM =====================================================
|
|
|
+
|
|
|
+REM Prompt for case number if not provided
|
|
|
+if "%~1"=="" (
|
|
|
+ set /p CASENO=Enter Case Number:
|
|
|
+) else (
|
|
|
+ set "CASENO=%~1"
|
|
|
+)
|
|
|
+
|
|
|
+if "%CASENO%"=="" (
|
|
|
+ echo ERROR: Case number cannot be empty.
|
|
|
+ exit /b 1
|
|
|
+)
|
|
|
+
|
|
|
+REM Source and destination paths
|
|
|
+set "SRC=Y:\%CASENO%"
|
|
|
+set "DEST=%USERPROFILE%\Downloads\SJLNT\%CASENO%"
|
|
|
+set "LOGFILE=%DEST%\robocopy_%CASENO%.log"
|
|
|
+
|
|
|
+echo.
|
|
|
+echo Case Number : %CASENO%
|
|
|
+echo Source : %SRC%
|
|
|
+echo Destination : %DEST%
|
|
|
+echo.
|
|
|
+
|
|
|
+REM Validate source
|
|
|
+if not exist "%SRC%" (
|
|
|
+ echo ERROR: Source path does not exist: %SRC%
|
|
|
+ echo Ensure Y: drive is mapped correctly.
|
|
|
+ exit /b 1
|
|
|
+)
|
|
|
+
|
|
|
+REM Create destination if missing
|
|
|
+if not exist "%DEST%" (
|
|
|
+ mkdir "%DEST%" || (
|
|
|
+ echo ERROR: Failed to create destination folder.
|
|
|
+ exit /b 1
|
|
|
+ )
|
|
|
+)
|
|
|
+
|
|
|
+echo Starting RoboCopy...
|
|
|
+echo This may take some time...
|
|
|
+echo.
|
|
|
+
|
|
|
+REM =====================================================
|
|
|
+REM RoboCopy command
|
|
|
+REM =====================================================
|
|
|
+robocopy "%SRC%" "%DEST%" ^
|
|
|
+ *.cap *.pcap *.sslkeys *.jpg *.jpeg *.png ^
|
|
|
+ /S /R:2 /W:5 /COPY:DAT /DCOPY:T ^
|
|
|
+ /NFL /NDL /TEE /LOG+:"%LOGFILE%"
|
|
|
+
|
|
|
+REM RoboCopy exit codes:
|
|
|
+REM 0-3 = SUCCESS
|
|
|
+if %ERRORLEVEL% GEQ 8 (
|
|
|
+ echo.
|
|
|
+ echo ERROR: RoboCopy failed with exit code %ERRORLEVEL%
|
|
|
+ echo Check log file: %LOGFILE%
|
|
|
+ exit /b %ERRORLEVEL%
|
|
|
+)
|
|
|
+
|
|
|
+echo.
|
|
|
+echo Copy completed successfully.
|
|
|
+echo Log file: %LOGFILE%
|
|
|
+echo Destination folder:
|
|
|
+echo %DEST%
|
|
|
+echo.
|
|
|
+
|
|
|
+endlocal
|
|
|
+exit /b 0
|