Created
May 10, 2023 05:21
-
-
Save vizsumit/1a84a0cbee6bd5f00bc1bfc0900a2b51 to your computer and use it in GitHub Desktop.
This script generates .txt caption files from .jpg file names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
for %%i in (*.jpg) do ( | |
set filename=%%i | |
set caption_filename=%%~ni.txt | |
set caption=%%~ni | |
setlocal EnableDelayedExpansion | |
for /f "tokens=1 delims=()" %%a in ("!caption!") do ( | |
set caption=%%a | |
) | |
for /f "tokens=* delims=0123456789()" %%b in ("!caption!") do ( | |
set caption=%%b | |
) | |
echo !caption! > %%~ni.txt | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Same, so i wrote my own version in Python: