Batch Search for Folder in a network share and reveal full UNC to folder

268 Views Asked by At

I was wondering if there was a way to achieve the following using batch files.

I need to establish a network path to a shared folder before I can ask a client to install software. Once I have the path I can configure the install package and ask them to deploy, all ready for when other elements of set up process completed.

In order to make it fool proof I was thinking I could instruct the customer to make a folder called e.g. "DataStore DO NOT MOVE" on any of their mapped drives\shares.

E.g. M:\ "or" S:\ "or" N:\ etc. etc. (with various dir's accessible to all users on the site)

Usually they have at least 1 or more.

So they make the folder "M:\DataStore DO NOT MOVE" "or" "M:\shared_area\DataStore DO NOT MOVE" "or" "S:\DataStore DO NOT MOVE" "or" "S:\shared_area\DataStore DO NOT MOVE"

and then run this batch file that searches the shared folders \ mapped drives for the specific folder created and reports back the full UNC, so

folder found on "\\Server\data\shared_area\DataStore DO NOT MOVE"

Hope that makes sense. And to be perfectly honest I don't know if this is possible as it's something I wouldn't know where to start with.

I had a look at this article How can I create a batch that searches all (unknown) shared folders on the local network for a specific folder? but did not work for me.

Ultimately I would prefer not to have the client do anything. The best solution would be they run the batch (or what ever it may end up being) it then finds a writable share or mapped drive, creates a folder of a defined name, then sends me the full path in a text file to my drop box. This stage I can achieve using "curl". Tried and tested.

Thanks in advance.

0

There are 0 best solutions below