Return a list files based on specific criteria. Multiple criteria are AND'd together.


age Select files whose age is equal to or greater than the specified time. Use a negative age to find files equal to or less than the specified time. You can choose seconds, minutes, hours, days, or weeks by specifying the first letter of any of those words (e.g., "1w").
  • One or more (shell or regex) patterns, which type is controled by C(use_regex) option.
  • The patterns restrict the list of files to be returned to those whose basenames match at least one of the patterns specified. Multiple patterns can be specified using a list.
contains One or more re patterns which should be matched against the file content
paths List of paths to the file or directory to search. All paths must be fully qualified. true
file_type Type of file to select
  • file
  • directory
recurse If target is a directory, recursively descend into the directory looking for files.
  • yes
  • no
size Select files whose size is equal to or greater than the specified size. Use a negative size to find files equal to or less than the specified size. Unqualified values are in bytes, but b, k, m, g, and t can be appended to specify bytes, kilobytes, megabytes, gigabytes, and terabytes, respectively. Size is not evaluated for directories.
age_stamp Choose the file property against which we compare age. Default is mtime.
  • atime
  • mtimectime
hidden Set this to true to include hidden files, otherwise they'll be ignored.
  • true
  • false
follow Set this to true to follow symlinks in path for systems with python 2.6+
  • true
  • false
get_checksum Set this to true to retrieve a file's sha1 checksum
  • true
  • false
use_regex If false the patterns are file globs (shell) if true they are python regexes
  • true
  • false


Brian Coca (based on Ruggero Marchei's Tidy)