Shorten filenames generated by Hugin and its components

30 views
Skip to first unread message

Abrimaal

unread,
Sep 29, 2022, 8:33:56 PM9/29/22
to hugin and other free panoramic software
If replacing _blended_fused and _fused to _b and _f is impossible in the software code,
I am trying to write a command line cleaner for Hugin files.
Go from the base folder, through all subfolders,
1. Delete all *.mk and *.log files
2. Rename all _blended_fused in filenames to _b
3. Rename all _fused in filenames to _f

The start folder is E:\foto

:STARTER
E:
set folder=foto
set foldercurrent=%folder%

:MAINLOOP
CD foldercurrent

goto SUBFOLDERCHECK

:CLEANER
if exist *.mk del *.mk
if exist *.log del *.log

:FINDER
if exist *.jpg CALL :RENAMER
if exist *.png CALL :RENAMER
if exist *.tif CALL :RENAMER
if exist *.pto CALL :RENAMER & CALL :INFILEREPLACE
REM rename other software files corresponding with images, one example below
if exist *.mch CALL :RENAMER

GOTO MAINLOOP

REM ==== subs =====

:SUBFOLDERCHECK
REM find the deepest subfolder
? if subfolder not exists goto :CLEANER
? set subfolder=subfolder name
cd subfolder
set foldercurrent=%foldercurrent%\%subfolder%
REM I completely do not know how to write this part
REM if there are many nested subfolders
REM after getting to the deepest subfolder
goto CLEANER
REM then move back to the base folder
REM and open the next subfolder
REM to check if all folders were processed, then exit the script
cls & echo ALL FILES PROCESSED & pause & exit /b


:RENAMER
set filename=%~nI
? if %filename% contains _blended_fused replace with _b
? if %filename% contains _fused replace with _f
REM by the way replace Windows file numbering [space][bracket]number[bracket] with _number
? if %filename% contains characters %20( replace with _
? if %filename% contains character ) remove from filename
REM replace unwanted characters
? if %filename% contains character . replace with _
? if %filename% contains character ~ replace with -
? if %filename% contains UTF character replace with basic letter
? build a filenamenew
ren filename filenamenew
exit /b

:INFILEREPLACE
REM panoramas may be built from other panoramas
notepad.exe filename
? if not exist _blended_fused in pto file exit /b
? if not exist _fused in pto file exit /b
? replace all _blended_fused with _b
? replace all _fused with _f
exit /b

----------------------

Variant 2 - use Windows search in the base folder
call Windows Search for *_blended_fused and rename the first file,
call Search again, if no more *_blended_fused, search for *_fused and rename
?

-------------------
Variant 3 - use an external batch rename app and in-file word replace,
called with parameters from command line
?

Abrimaal

unread,
Nov 26, 2022, 8:48:51 PM11/26/22
to hugin and other free panoramic software
Writing this is above my programming skills, and it is very important for seamless workflow.

This is my request to the developers, to consider shortening these suffixes in the source:
_fused, _blended_fused, _exposure_layers, _stack to one or two characters.
Or let the user define the suffixes in settings.

Below an example: a panorama created from stacks and any arrangement
One suffix is _blended_fused, the other is _fused.
Now merging both panoramas, using selectve masking.
It will create new files, named _blended_fused_blended_fused and so on. It depends how many times it will be processed.
... and there are hundreds or such panoramas to process.

kundelsdorf-masks.jpg

David W. Jones

unread,
Nov 26, 2022, 11:35:42 PM11/26/22
to hugi...@googlegroups.com
A user-defined setting makes sense to me. MS Windows has lower filename length limits than other platforms, yes?

--
David W. Jones
gnome...@gmail.com
exploring the landscape of god
http://dancingtreefrog.com

Sent from my Android device with F/LOSS K-9 Mail.
Reply all
Reply to author
Forward
0 new messages