mercredi 5 octobre 2016

find specific folder in any mapped drive and report its full UNC path

Vote count: 0

I was wondering if it was possible using a batch file to find a specific folder in any mapped drive of a PC and have it report the folders full UNC path. Lets say a PC has drives mapped of N:\ & S:\ (or any usual network drive letter for that matter). The folder could be in either folder and I run some code to find where the folder is, it will be in the root of the drive share (avoiding need for recursive subfolder scanning) e.g. N:\Special_Folder however, the end result of the code will report the FULL UNC e.g.

Folder Found!..

\server-vm01\data\shared_area\special_folder

Hope that makes sense. I have tried with some code I already use to identify a USB stick, but am having difficulty porting it to the needs above. Any pointers would be great, thank you.

for %%a in (d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:) do | find "special_folder" >nul && set unc=%%a:
echo %unc%
pause

asked 17 secs ago

Let's block ads! (Why?)



find specific folder in any mapped drive and report its full UNC path

Aucun commentaire:

Enregistrer un commentaire