Use the function $$IsDirectory to check whether the directory path is valid or not. This function returns logical value, Yes or No .
Example
[Function: Test Function]
00 : Log: $$IsDirectory:"D:\"
10 : Log: $$IsDirectory:"D:\TEST"