How to kill/delete files in a folder
Posted on 2009-04-08
I am working in Access 2002 and I am trying to kill/delete files (if any) in my windows xp explorer folder. I wrote the following constant to identify the path. However when it gets to the if statement A_ImportDir_MIC actually equals the path so it drops into my if statement to kill the files even though there are no files in the folder Micros email attachments.
How can I rewrite the script to make sure its looking for the files within the folder with the *.txt extensions and if there are none get out of the if statement? Thank you.
Option Compare Database 'Use database order for string comparisons
Const A_ImportDir_MIC = "C:\Micros email attachments\"
'KILL THE FILES
If A_ImportDir_MIC <> "" Then
Kill "C:\Micros email attachments\*.txt"