Click or drag to resize
StorageHelperDeleteOldFiles Method (DirectoryInfo, DateTime, Boolean)
Deletes files older than specified time from the file system.

Namespace: CMS.IO
Assembly: CMS.IO (in CMS.IO.dll) Version: 8.2.23
Syntax
C#
public static bool DeleteOldFiles(
	DirectoryInfo dir,
	DateTime olderThan,
	bool deleteEmptyFolder = true
)

Parameters

dir
Type: CMS.IODirectoryInfo
Directory to process
olderThan
Type: SystemDateTime
Limit time for deletion of a file
deleteEmptyFolder (Optional)
Type: SystemBoolean
Indicates if the specified folder should be deleted if there are no files left at the end

Return Value

Type: Boolean
See Also