nipype icon indicating copy to clipboard operation
nipype copied to clipboard

Request: flag to glob.glob to search recursively for template in Selectfiles()

Open luisa-sophia opened this issue 10 months ago • 0 comments

Currently, SelectFiles() does not leave much room to handle subjects with incongruent file locations. At this point, it is not possible to specify a template pattern that matches paths with different number of subdirectories between root and file, which requires ugly workarounds. However, this could be easily solved by setting the recursive flag in glob.glob() in SelectFiles() to true, which would allow a pattern like "a/b/**/file.txt" to match both paths "a/b/c/file.txt", as well as "a/b/file.txt". Would it be possible to add this to SelectFiles() (e.g. as an argument) such that glob.glob() optionally employs a recursive search strategy?

See nipype/nipype/interfaces/io.py -->filelist = glob.glob(template)) (line 1239)

Thanks, Luisa

luisa-sophia avatar Apr 09 '24 09:04 luisa-sophia