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
?

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/fb06f1bc-2e27-4617-ac6e-02f4cd45427dn%40googlegroups.com.

Reply via email to