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.

Thanks
Pat

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:

Cheers,
Mark

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

Thanks

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