Method filesystem.delete(+ 1 overload)
Overload
Deletes file or directory if exists.
public static bool? delete(string path, FDFlags flags = 0)
Parameters
Returns
bool?
|
Exceptions
ArgumentException
path is not full path (see pathname.isFullPath). |
AuException
Failed. |
Remarks
Does nothing if it does not exist (no exception). If directory, also deletes all its files and subdirectories. If fails to delete some, tries to delete as many as possible. Deletes read-only files too. Does not show any message boxes etc (confirmation, error, UAC consent, progress).
Some reasons why this function can fail:
- The file is open (in any process). Or a file in the directory is open.
- This process does not have security permissions to access or delete the file or directory or some of its descendants.
- The directory is (or contains) the "current directory" (in any process).
Overload(top)
Deletes multiple files or/and directories.
public static bool? delete(IEnumerable<string> paths, FDFlags flags = 0)
Parameters
paths (IEnumerable<string>)
string array, List or other collection. Full paths. |
flags (FDFlags) |
Returns
bool?
|
Exceptions
ArgumentException
path is not full path (see pathname.isFullPath). |
AggregateException
Failed to delete all or some items. The AggregateException object contains AuException for each failed-to-delete item. |
Remarks
This overload is faster when using Recycle Bin. If fails to delete some items specified in the list, deletes as many as possible.