FROM THIS CODE I WANT YOU TO DO SOME ACTES : @echo off setlocal EnableDelayedExpansion…
- User
FROM THIS CODE I WANT YOU TO DO SOME ACTES :
@echo off setlocal EnableDelayedExpansion
for %%a in (*.jpg) do ( echo %%a | findstr "" > nul if !errorlevel! == 1 ( REM No underscore found, use the filename as the folder name if not exist "%%~na" mkdir "%%~na" move "%%a" "%%~na" ) else ( REM Underscore found, use the part before the underscore as the folder name for /f "tokens=1 delims=" %%b in ("%%a") do ( if not exist "%%b" mkdir "%%b" move "%%a" "%%b" ) ) ) echo Files organized! pause endlocal
@echo off set /p "template=Enter the path to your HTML template file: "
for /d %%a in (*) do ( pushd "%%a" copy "%template%" "%%a.html"
codeecho ^<body^> > temp.html for %%b in (*.jpg) do ( echo ^<p^>^<img style="display: block; margin-left: auto; margin-right: auto;" src="%%b" alt="Veuillez activer votre connexion Internet" /^>^</p^> >> temp.html ) echo ^</body^> >> temp.html echo ^</html^> >> temp.html type temp.html >> "%%a.html" del temp.html popd) echo HTML files created! pause
@echo off
set "destination_folder=%~dp0"
for /r "%destination_folder%" %%a in (*) do ( if "%%~dpa" NEQ "%destination_folder%" ( move "%%a" "%destination_folder%" ) )
for /d /r "%destination_folder%" %%a in (*) do ( if "%%a" NEQ "%destination_folder%" ( rmdir /q /s "%%a" ) )
echo Files moved and empty folders deleted successfully! pause
I WANT TO FIX SOMES PROBLEMS WHENE I Creates HTML files with image galleries; whene the Src of images added i see it like XX1-1_1.jpg XX1-1_10.jpg XX1-1_11.jpg XX1-1_12.jpg XX1-1_13.jpg XX1-1_2.jpg XX1-1_3.jpg XX1-1_4.jpg XX1-1_5.jpg XX1-1_6.jpg XX1-1_7.jpg XX1-1_8.jpg XX1-1_9.jpg and i want the src be sort like XX1-1_1.jpg XX1-1_2.jpg XX1-1_3.jpg XX1-1_4.jpg XX1-1_5.jpg XX1-1_6.jpg XX1-1_7.jpg XX1-1_8.jpg XX1-1_9.jpg XX1-1_10.jpg XX1-1_11.jpg XX1-1_12.jpg XX1-1_13.jpg
- Assistant
To fix the issue where the image sources in your HTML files are not sorted numerically (e.g.,
XX1-1_10.jpgappearing beforeXX1-1_2.jpg), you need to modify your batch script to sort the image filenames numerically when generating the HTML content.Here's how you can fix it:
Modify the image processing loop to sort filenames numerically
Replace the line:
batch