Storing output at a dynamic location

I want to build an RPA which takes input files from a folder which has many sub-folders init and and different files too and then want to process a particular kind of files and then for those input i want to store those output in dynamic location like:
input folder path:
(the master path will be constant but since i am serching for a particular kind of files it will have to go through different subfolders so the path “Child1\Child2\Child3” is dynamic)
and i want the processed output file folder to be:
(the master output path whill be contant but since i want the same folder structure inside the output folder too, i want the output files to be in the same sub-folder structure)

How can i do it?
can anyone help please?

Hi @Aishwarya_Bhargava,

Path.GetDirectoryName(filePath) - Returns only the folder structure without the file name.
Then you can replace the masterPath in the above value with masterOutputPath.

Path.GetDirectoryName(filePath).Replace(masterPath, masterOutputPath)

Then you can use the Create folder activity to create the new folder path, it will create all the sub-folders too.

Hope it helps!

Happy coding! :slight_smile:

Hi @Aishwarya_Bhargava,
will that masterpath and the sub folder names remain same?


You need to replace the master path with the master output path.

Then all the subfolders inside both of them will be the same

Hi @Aishwarya_Bhargava

Can you give the Screenshot of the path like as shown below :-


For eg from above img till “Practise Solutions for Forum” is my Main Constant path and what all should be der in the structure i have shown for eg

Same can you share

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer: