GeoEco.DataManagement.Directories.Directory.FindAndDelete
- classmethod Directory.FindAndDelete(inputDirectory, removeTree=False, wildcard='*', searchTree=False, mustBeEmpty=False, mustNotBeEmpty=False, minDateCreated=None, maxDateCreated=None, minDateModified=None, maxDateModified=None)
Finds and deletes directories in a directory.
- Parameters:
inputDirectory (
str) – Directory to search. Minimum length꞉ 1. Must exist.removeTree (
bool, optional) – If True, all files and subdirectories contained in the directory will be deleted. If False, the directory must be empty or deletion will fail.wildcard (
str, optional) –UNIX-style “glob” wildcard expression specifying the directories 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.mustBeEmpty (
bool, optional) – If True, only empty directories will be found.mustNotBeEmpty (
bool, optional) – If True, only non-empty directories will be found.minDateCreated (
datetime, optional) – Minimum creation date, in the local time zone, of the directories to find, as reported by the operating system. If provided, only directories 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 directories to find, as reported by the operating system. If provided, only directories 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 directories to find, as reported by the operating system. If provided, only directories 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 directories to find, as reported by the operating system. If provided, only directories 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: