as I stated in my other post : viewtopic.php?f=3&t=9116 I'm trying to process files in many sub folders.
I came up with this short script in the last few hours which does almost everything I want.
Code: Select all
@echo off SetLocal ENABLEDELAYEDEXPANSION rem define original path (e.g. C:\original\*) - must exist set "originalPath=C:\original\*" rem define output path (e.g c:\output\) must exist set "outputPath=C:\output\" define CloudCompare path with first parameters -O = open and export format set "programPath="C:\Program Files\CloudCompare\cloudcompare.exe"-SILENT -C_EXPORT_FMT BIN " rem first loop to process all sub folders in original folder for /d %%A in (%originalPath%) do ( set subFolderPath=%%A\* echo Processing Files In Folder ... "%%~nxA" rem second loop to loop through all files in sub folder for %%F in (!subFolderPath!) do ( set fileName=%%~nxA%.bin set "filesToMerge=-O %%F " ) rem set "parameter=-SAVE_CLOUDS ALL_AT_ONCE FILE: !outputPath!!fileName!" set "commandLine=%programPath%!filesToMerge!!parameter!" echo !commandLine! ) ENDLOCAL pause
Let me try to explain what I want to achieve there:
In that loop I iterate over the files in a given sub folder (subFolderPath). In the end I want to store the path of every file into one single variable called "filesToMerge".
If there were two files in the sub folder the echo of the variable should be for example "-O C:\originals\1\Scan_01.bin -O C:\originals\1\Scan_03.bin"
Right now obviously only the last file path is stored in that variable. How can I concatenate every path of every file in the same sub folder into that or a different named variable?
In the end I want the batch to concatenate and then execute the following variables: commandLine = programPath + filesToMerge + parameter. This would be the first sub folder, and then the batch moves on to the next sub folder.
I hope this is not to confusing and one of you is able to help me with this!
p.s.: if this topic needs to be moved to my original post, feel free to do so
p.p.s: I guess I can move the line "set fileName=%%~nxA%.bin" into the first loop right?