JCL Help:DelTreeEx

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Recursively deletes a folder.


Pascal

 function DelTreeEx(const Path: string; AbortOnFailure: Boolean; Progress: TDelTreeProgress): Boolean;


Parameters

Parameters Description
const Path: string The folder to delete. Must be fully qualified. May have a trailing backslash but that's optional.
AbortOnFailure: Boolean If True the function immediately returns when it encounters a file or directory it cannot delete. If False the function continues attempting to delete the remaining Files. In either case, if one or more files couldn't be deleted the function result is False.
Progress: TDelTreeProgress Function that is called just before a file is deleted. This allows you to display progress to the user and even abort the deletion. This parameter is optional (you can specify nil). See TDelTreeProgress For more information.


Return Value

If the function succeeds in deleting the folder the result is True, if the function fails the result is False. In case of failure the function attempts to delete as much as possible before returning or continues deleting depending on the AbortOnFailure parameter. Thus on failure part of the folder may have been deleted while some files and folders may still exist. Failure is usually due to insufficient access rights or because some files are currently open (locked).


Description

DelTree recursively deletes a folder much like the DOS command. That is, it deletes a folder and everything in it. If parts of the folder tree cannot be deleted, eg because some files may be currently open, the function attempts to delete as much as possible before returning or immediately returns, depending on the AbortOnFailure parameter. The function is capable of providing the caller with progress information through the Progress function parameter.


See Also

DelTree


About

Unit

JclFileUtils


Donator

John C Molyneux


Contributors

Robert Rossmair


Notes

The deletions are permanent! Deletions are not recoverable through the recycle bin.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page