Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rename_images.bat 881B

1234567891011121314151617181920212223242526272829303132
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. REM Path to your folder containing images (current directory)
  4. set "folder_path=%~dp0"
  5. echo Folder path: %folder_path%
  6. REM Counter for renaming
  7. set "counter=1"
  8. REM Loop through each file in the folder
  9. for %%F in ("%folder_path%\*") do (
  10. echo Processing file: %%F
  11. REM Check if the file exists and is not a directory
  12. if exist "%%F" if not exist "%%F\" (
  13. REM Extract the numeric part from the filename
  14. for /f "tokens=3 delims=-." %%A in ("%%~nF") do (
  15. REM Rename the file to saree[counter].[extension]
  16. for %%X in ("%%~xF") do (
  17. ren "%%F" "saree!counter!%%X"
  18. echo Renamed "%%~nxF" to saree!counter!%%X
  19. )
  20. )
  21. REM Increment the counter
  22. set /a "counter+=1"
  23. ) else (
  24. echo %%F is not a regular file.
  25. )
  26. )
  27. pause