|
@echo off |
|
setlocal enabledelayedexpansion |
|
|
|
rem Set the log file name with timestamp |
|
set "logfile=missing_txt_files_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%time:~0,2%%time:~3,2%%time:~6,2%.log" |
|
set "logfile=!logfile: =0!" |
|
|
|
rem Clear the log file if it exists |
|
if exist "%logfile%" del "%logfile%" |
|
|
|
echo Scanning for JPG and JXL files without corresponding TXT files... |
|
echo Starting scan at %date% %time% > "%logfile%" |
|
echo ================================================== >> "%logfile%" |
|
|
|
set /a count=0 |
|
set /a missing=0 |
|
|
|
rem Search for JPG files |
|
for /r %%f in (*.jpg) do ( |
|
set /a count+=1 |
|
|
|
rem Check if corresponding TXT file exists (using direct path to avoid delayed expansion) |
|
if not exist "%%~dpnf.txt" ( |
|
rem Calculate size in KB |
|
set /a sizeKB=%%~zf/1024 |
|
if !sizeKB! equ 0 set /a sizeKB=1 |
|
|
|
echo Missing TXT: %%f ^(!sizeKB! KB^) |
|
echo %%f ^(!sizeKB! KB^) >> "%logfile%" |
|
set /a missing+=1 |
|
) |
|
) |
|
|
|
rem Search for JXL files |
|
for /r %%f in (*.jxl) do ( |
|
set /a count+=1 |
|
|
|
rem Check if corresponding TXT file exists (using direct path to avoid delayed expansion) |
|
if not exist "%%~dpnf.txt" ( |
|
rem Calculate size in KB |
|
set /a sizeKB=%%~zf/1024 |
|
if !sizeKB! equ 0 set /a sizeKB=1 |
|
|
|
echo Missing TXT: %%f ^(!sizeKB! KB^) |
|
echo %%f ^(!sizeKB! KB^) >> "%logfile%" |
|
set /a missing+=1 |
|
) |
|
) |
|
|
|
rem Add summary to log file |
|
echo. >> "%logfile%" |
|
echo ================================================== >> "%logfile%" |
|
echo Scan completed at %date% %time% >> "%logfile%" |
|
echo Total JPG/JXL files found: !count! >> "%logfile%" |
|
echo Files missing TXT: !missing! >> "%logfile%" |
|
|
|
rem Display summary |
|
echo. |
|
echo Scan completed! |
|
echo Total JPG/JXL files found: !count! |
|
echo Files missing corresponding TXT files: !missing! |
|
echo. |
|
echo Log file saved as: %logfile% |
|
|
|
pause |