Search for a folder using applescript
For local files/folders
you can use spotlight's command line tools. In Terminal
$ mdfind -onlyin ~/ &quot;kMDItemDisplayName == 'xyz*' &amp;&amp; kMDItemKind == 'Folder'&quot;

will give you all folders whose name starts with xyz with the search begining from your home folder ~/. Remove * in xyz* above to find an exact match. For more information on mdfind read the man page using the command man mdfind in Terminal app.
You can use it in your script like this...
set res to (do shell script &quot;mdfind -onlyin ~/ \&quot;kMDItemDisplayName == 'xyz' &amp;&amp; kMDItemKind == 'Folder'\&quot;&quot;)    
set fList to (every paragraph of res) as list    
log &quot;Count:&quot; &amp; (get count of fList)


For remote files
that spotlight doesn't know about, you can use the good old UNIX find command.
$ find ~/ -iname &quot;xyz&quot; -type d

You can use it in your script the same way as mdfind but it may be a bit slower.
Hope that helped.