Using EXIST like that as you've seen doesn't work. Perhaps this UDF might work better for that, but the other suggestions would probably be better anyways.

EmptyFolder() - checks if folder is empty