Declare Function RemoveDirectory Lib "kernel32.dll" Alias "RemoveDirectoryA" (ByVal lpPathName As String) As Long
Platforms: Win 32s, Win 95/98, Win NT
RemoveDirectory deletes a directory from a disk. The function will not delete any files or subdirectories inside the directory. If the directory to delete is not completely empty, the function will fail. The function returns 1 if successful, or 0 if an error occured.
Example:
' Delete the directory C:\MyPrograms\TempData.
Dim retval As Long ' return value
retval = RemoveDirectory("C:\MyPrograms\TempData") ' delete the directory
If retval = 1 Then ' success
Debug.Print "C:\MyPrograms\TempData was successfully deleted."
Else
Debug.Print "Deletion failed. Make sure C:\MyPrograms\TempData is empty."
End If
Related Call: CreateDirectory
Category: Files
Back to the index.