@@ -1186,17 +1186,19 @@ def _list_outputs(self):
11861186class SelectFilesInputSpec (DynamicTraitedSpec , BaseInterfaceInputSpec ):
11871187
11881188 base_directory = Directory (exists = True ,
1189- desc = "Root path common to templates." )
1189+ desc = "Root path common to templates." )
11901190 sort_filelist = traits .Bool (True , usedefault = True ,
1191- desc = "When matching mutliple files, return them in sorted order." )
1191+ desc = "When matching mutliple files, return them in sorted order." )
11921192 raise_on_empty = traits .Bool (True , usedefault = True ,
1193- desc = "Raise an exception if a template pattern matches no files." )
1193+ desc = "Raise an exception if a template pattern matches no files." )
11941194 force_lists = traits .Either (traits .Bool (), traits .List (Str ()),
1195- default = False , usedefault = True ,
1196- desc = ("Whether to return outputs as a list even when only one file "
1197- "matches the template. Either a boolean that applies to all "
1198- "output fields or a list of output field names to coerce to "
1199- " a list" ))
1195+ default = False , usedefault = True ,
1196+ desc = ("Whether to return outputs as a list even when only one file "
1197+ "matches the template. Either a boolean that applies to all "
1198+ "output fields or a list of output field names to coerce to "
1199+ " a list" ))
1200+ directory_mode = traits .Bool (False , usedefault = True ,
1201+ desc = "Return only directories." )
12001202
12011203
12021204class SelectFiles (IOBase ):
@@ -1303,6 +1305,10 @@ def _list_outputs(self):
13031305 else :
13041306 template = op .abspath (template )
13051307
1308+ if self .inputs .directory_mode :
1309+ # return only directories
1310+ template += os .sep
1311+
13061312 # Fill in the template and glob for files
13071313 filled_template = template .format (** info )
13081314 filelist = glob .glob (filled_template )
0 commit comments