Method DeleteFiles
DeleteFiles(string?, string)
Deletes files in the specified folder that match the given search pattern.
public static bool DeleteFiles(string? pathToFolder, string searchPattern)
Parameters
pathToFolderstringThe path to the folder where files will be deleted.
searchPatternstringThe search pattern to match files (e.g., "*.txt").
Returns
- bool
trueif the operation succeeds or the folder does not exist;falseif an exception occurs during the operation.