Shorten filenames generated by Hugin and its components

Skip to first unread message


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

set folder=foto
set foldercurrent=%folder%

CD foldercurrent


if exist *.mk del *.mk
if exist *.log del *.log

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


REM ==== subs =====

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
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

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

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


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.


David W. Jones

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

David W. Jones
exploring the landscape of god

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