# Creating script to process RC for multiple folders in sequence

**URL:** <https://forums.unrealengine.com/t/creating-script-to-process-rc-for-multiple-folders-in-sequence/1956932>\
**Category:** Pipeline & Plugins\
**Tags:** realityscan\
**Created:** [July 31, 2024, 2:54pm UTC](https://forums.unrealengine.com/t/creating-script-to-process-rc-for-multiple-folders-in-sequence/1956932 "2024-07-31T14:54:59Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![OndrejTrhan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ondrejtrhan/32/906565_2.png) [@OndrejTrhan](https://forums.unrealengine.com/u/OndrejTrhan)\
**Post date:** [August 2, 2024, 7:16am UTC](https://forums.unrealengine.com/t/creating-script-to-process-rc-for-multiple-folders-in-sequence/1956932/11 "2024-08-02T07:16:00Z")

</div>

Hi,  
as I wrote you before, the script wasn’t refined.  
It should work like this (this one was tested):

```auto
:: root path to work folders where all the datasets are stored (%~dp0 means the folder in which this script is stored)
set RootFolder=%~dp0

:: path to RealityCapture application
set RealityCaptureExe="C:\Program Files\Capturing Reality\RealityCapture\RealityCapture.exe"

::Create loop on which to run RC for all subfolders
:: for /R %%f in (%RootFolder%\..) do >>runscriptrealitycapture

for /D %%f in ("%RootFolder%*") do (
        ::echo Processing folder: '%%f'^

        :: run RealityCapture
        %RealityCaptureExe% ^
                -newScene ^
                -addFolder "%%f\Images" ^
                -detectMarkers ^
				-importGroundControlPoints "%%f\Settings\DetectPositions.txt" ^ 
				-align ^
				-save "%%f\Project\Project.rcproj" ^
                -selectMaximalComponent "%%f\Project\Project.rcproj" ^
                -setReconstructionRegion "%%f\Settings\forCutFACS.rcbox" ^ 
				-calculateHighModel ^
				-save ^
				-selectLargestModelComponent ^
				-invertTrianglesSelection ^
				-removeSelectedTriangles ^
				-renameSelectedModel "Unedited" ^
				-exportSelectedModel "%%f\Outputs\Harlander_Unedited.obj" ^
				-save ^
                -quit
)

```

But it is possible that in attached script are unnecessary spaces, so you will need check for that.

---

_[View the full topic](https://forums.unrealengine.com/t/creating-script-to-process-rc-for-multiple-folders-in-sequence/1956932)._
