Dim MyDirectory As String
MyDirectory = "c:\test" ' Name of directory want to delete all files in.
Kill MyDirectory & "\*.*" ' Delete all files in 'MyDirectory'
any way i could modify this code to check if ANY files exist before killing all files, as a file not found error occurs if directory is already empty ?
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Sorry, hit Submit instead of Preview:
[tt]
If Len(Dir("c:\test\fred\*.*")) = 0 Then
'Directory is empty
Else
'do delete here[/tt]
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.