|
66 | 66 | required: false |
67 | 67 | description: |
68 | 68 | - Type of file to select |
69 | | - choices: [ "file", "directory", "link" ] |
| 69 | + choices: [ "file", "directory", "link", "any" ] |
70 | 70 | default: "file" |
71 | 71 | recurse: |
72 | 72 | required: false |
@@ -275,7 +275,7 @@ def main(): |
275 | 275 | paths = dict(required=True, aliases=['name','path'], type='list'), |
276 | 276 | patterns = dict(default=['*'], type='list', aliases=['pattern']), |
277 | 277 | contains = dict(default=None, type='str'), |
278 | | - file_type = dict(default="file", choices=['file', 'directory', 'link'], type='str'), |
| 278 | + file_type = dict(default="file", choices=['file', 'directory', 'link', 'any'], type='str'), |
279 | 279 | age = dict(default=None, type='str'), |
280 | 280 | age_stamp = dict(default="mtime", choices=['atime','mtime','ctime'], type='str'), |
281 | 281 | size = dict(default=None, type='str'), |
@@ -337,7 +337,11 @@ def main(): |
337 | 337 | continue |
338 | 338 |
|
339 | 339 | r = {'path': fsname} |
340 | | - if stat.S_ISDIR(st.st_mode) and params['file_type'] == 'directory': |
| 340 | + if params['file_type'] == 'any': |
| 341 | + if pfilter(fsobj, params['patterns'], params['use_regex']) and agefilter(st, now, age, params['age_stamp']): |
| 342 | + r.update(statinfo(st)) |
| 343 | + filelist.append(r) |
| 344 | + elif stat.S_ISDIR(st.st_mode) and params['file_type'] == 'directory': |
341 | 345 | if pfilter(fsobj, params['patterns'], params['use_regex']) and agefilter(st, now, age, params['age_stamp']): |
342 | 346 |
|
343 | 347 | r.update(statinfo(st)) |
|
0 commit comments