developingprogrammer
asked on
delete all files from folder even if folder is blank
hey guys,
i'm using this code to delete all files from the folder
however when there are no files in the folder it gives me this error message
Run-time error '53':
File not found.
Question: what is the code i should use to delete all files in a folder, regardless if there are files or not?
Thoughts: i'm thinking just put a On Error Resume Next and an On Error Goto 0 but that would be an easy way out and we won't learn anything by taking easy ways during training = )
thanks guys!
i'm using this code to delete all files from the folder
Kill CurrentProject.Path & "\Working Folder\*"
however when there are no files in the folder it gives me this error message
Run-time error '53':
File not found.
Question: what is the code i should use to delete all files in a folder, regardless if there are files or not?
Thoughts: i'm thinking just put a On Error Resume Next and an On Error Goto 0 but that would be an easy way out and we won't learn anything by taking easy ways during training = )
thanks guys!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi Christian!
yup i fully agree with you, i'm thinking that if there is a one liner code to test the folder then i'll use that, if not i'll use on error resume next because that is the most economical way of doing it and then i can use my time to focus on more productive development. thanks for confirming it and once again sharing more insight on the right mindset for programming, not just the technical code itself! = )