This script will detect if a folder exists. Set the variable (folder) to any folder location you want.
Get a better resolution image
Why does this work? The folder the program is trying to detect (Folder A) will only exist if the folder Folder A is in contains Folder A. It sounds complicated, but if you look at the script closely, you'll get it.