Forum Discussion
rmanning
15 years agoContributor
Little worried to ask as this could cause potential security issues, but is there a way to delete the entire contents of a folder using VBScript? That way I could "flush" this screenshots folder at the start of the script routine to avoid attaching images from previous executions of the script.
UPDATE: I've figured out how to deleted or flush the directory by inserting the following code before the End Sub line of the MainTest:
For Each aFile In oFolder.Files
aFile.Delete
Next
However, I've notice I will get an error if the screenshots folder is empty and the email script is ran (see attached image); Is there any way to change this so to avoid this error? I will do my best to figure out a solution, but if anyone has any insight, please feel free to share :)
Thanks!
UPDATE: I've figured out how to deleted or flush the directory by inserting the following code before the End Sub line of the MainTest:
For Each aFile In oFolder.Files
aFile.Delete
Next
However, I've notice I will get an error if the screenshots folder is empty and the email script is ran (see attached image); Is there any way to change this so to avoid this error? I will do my best to figure out a solution, but if anyone has any insight, please feel free to share :)
Thanks!
Related Content
- 7 years ago
- 13 years ago
Recent Discussions
- 17 hours ago
- 17 hours ago
- 4 days ago