Support Topics Documentation Slack YouTube Blog

Delete Directory - Existence Check

Hi - I have a codeless Event Handle, part of which deletes a directory. I need to put an existence check in there so it only attempts to delete if the directory exists.

I can’t work out how to make that happen! Sure its simple, any pointers greatly appreciated.


Hi Pat,

Indeed, there is no block to check if a path exists. This is not a problem though. I’d solve it this way:


Works like a charm - thanks

1 Like

I’m trying to create a file exists function and using this as a basis… If I simply change the “Get Directory Listing” for a “Read File” block - should that do the job? Or am I headed down the wrong path(!) again


You can try that. Or alternatively, do you see the pattern parameter in the directory listing? If you pass the file name for the pattern and the directory listing returns a list of size 0, it means the file is not there.

even better - thanks