How to manage differents subfolders for images saving


I wrote a pipeline in cellprofiler that I would like to apply to different series of images.
My images are distributed as follows: a main directory used as “input directory” in CP with, for each series of images, a subdirectory that contains the images of this series.
I also have an output directory in which there is a (empty) subdirectory for each series to receive the results of this series.
I would like CP to successively treat the subdirectories of the input directory and export the data in the corresponding subdirectory of the directory “output”
I extracted a metadata corresponding to the name of the starting directory using this regex : . * [\ /] (? P . *) $
I save my results in the subdirectory “output / folder”
It works perfectly when there is only one subfolder in the input directory but if there are several, CP creates a sub-directory called “none” and all the images crash into this subdirectory.

I tried to group the images but It did not work with more than one subdirectory.

I tried “CreateBatchFiles” procedure module using these command lines :
cd C:\Program Files (x86)\CellProfiler\
cellprofiler -p C:\test_FIJI_macro\arrivee_petit\CP_results\test/Batch_data.h5 -c -r

but got an export error :
WindowsError: [Error 123] The syntax of the file, directory, or volume name is incorrect: u’C: \ g folder ’

Can’t find where I went wrong?

Is there a “simple solution” to run this analysis?
If there is no “simple solution”, is it possible to call CP from ImageJ?
My images come from an IJ macro and it could be great to call CP directly from this IJ macro in my case.

Thanks for your help !

PS1 : You can find my CP pipeline and examples of input directory (FIJI_results_testCP) and ouput directory after run (CP_results) here :

PS2 : I am a pathologist, not a computer scientist so most of the time I do not fully understand what computer scientist say ! :scream: … but I try, realy ! :nerd_face::face_with_monocle:

In fact things have worked out without me understanding how!
I deleted some images in the module “NamesAndTypes” and … it started to work!
I reintroduced these images one after the other and it worked!?!
There must have been an error in my module “NamesAndTypes” but I do not see/understand which one.
No matter, now it works like a charm …
I definitely love CellProfiler!