DirectoryDelete (Dundas Upload Control 2.0)

Dundas

DirectoryDelete (Dundas Upload Control 2.0)

Overview | Properties | Methods

Call this method to delete a folder.

Syntax

UploadObject.DirectoryDelete(Path As String[, DeleteContent As Bool = FALSE] )

The DirectoryDelete method syntax has the following parts:

Part

Description

Path

The name of the folder to be deleted. Either a virtual or physical pathname must be used, depending on the UseVirtualDir property setting.

DeleteContent

If set to TRUE then the folder and all of its contents will be deleted.

  Remarks

An exception is thrown if the operation fails (the Number property of the Err object will be a non-zero value upon failure). MAKE SURE that you have enabled inline error trapping by using an On Error Resume Next statement at the beginning of the ASP page.

If the default user account does not have permission to delete a folder then an "Access Denied" error will occur. You can use the ImpersonateUser method to temporarily assume another user account which has the permission to delete a folder and then call ImpersonationTerminate to resume using the default account. For more details on deleting uploaded files at the server refer to the UploadedFile Object topic.

An exception is raised if the specified folder does not exist, and the resulting error string is "The system can not find the file specified". Trying to delete a folder which is not empty and DeleteContent = FALSE also results in an exception, and the resulting error string from this situation is "The directory is not empty".

If UseVirtualDir is set to TRUE then the specified path needs to be relative. It should start with a forward slash and be followed by a valid alias, and any sub-folders need to be separated with forward slashes. If you specify a physical pathname when UseVirtualDir is TRUE an exception will be thrown.

See Also: DirectoryCreate | DirectoryExists