GeoEco.DataManagement.Files.File.FindAndDelete
- classmethod File.FindAndDelete(inputDirectory, wildcard='*', searchTree=False, minSize=None, maxSize=None, minDateCreated=None, maxDateCreated=None, minDateModified=None, maxDateModified=None)
Finds and deletes files in a directory.
- Parameters:
inputDirectory (
str) – Directory to search. Minimum length꞉ 1. Must exist.wildcard (
str, optional) –UNIX-style “glob” wildcard expression specifying the pathnames to find.
The glob syntax supports the following patterns:
?- matches any single character*- matches zero or more characters[seq]- matches any single character inseq[!seq]- matches any single character not inseq
seqis one or more characters, such asabc. You may specify character ranges using a dash. For example,a-z0-9specifies all of the characters in the English alphabet and the decimal digits0through9.You may specify subdirectories in the glob expression. For example, the expression
cruise*/sst*will find all paths beginning with sst that are contained in directories beginning with cruise.The operating system determines whether
/or\is used as the directory separator. On Windows, both will work. On Linux,/must be used.The operating system determines if matching is case sensitive. On Windows, matching is case-insensitive. On Linux, matching is case-sensitive.
Minimum length꞉ 1.
searchTree (
bool, optional) – If True, subdirectories will be searched.minSize (
int, optional) – Minimum size, in bytes, of files to find. If provided, only files that are this size or larger will be found. Minimum value꞉ 0.maxSize (
int, optional) – Maximum size, in bytes, of files to find. If provided, only files that are this size or smaller will be found. Minimum value꞉ 0.minDateCreated (
datetime, optional) – Minimum creation date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were created on or after this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.maxDateCreated (
datetime, optional) – Maximum creation date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were created on or before this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.minDateModified (
datetime, optional) – Minimum modification date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were modified on or after this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.maxDateModified (
datetime, optional) – Maximum modification date, in the local time zone, of the files to find, as reported by the operating system. If provided, only files that were modified on or before this date will be found. You may provide a date with or without a time. If you do not provide a time, it is assumed to be midnight.
- Returns:
Directory to search. Minimum length꞉ 1. Must exist.
- Return type: