Get server name from UNC path
4 answers
I don't know the Win32 API for parsing a UNC path; however you should check:
-
\\computername\share
-
\\?\UNC\computername\share
(people use this to access long paths> 260 characters) - You can also handle this case:
smb://computername/share
and this casehostname:/directorypath/resource
+1
a source to share
If you get the data in plain text you will be able to parse it with a simple regex, not sure which language you are using, but I try to use perk for quick searches like this. Suppose you have a large document containing multiple lines containing one path per line, which you can search in \\ Ie m / \\\\ ([0-9] [0-9] [0-9] \ . (repeat 3 times, of course without triggering the IP address requirements, you may need to change the first one) then \\)? To make it optional and include a trailing slash, and finally (. *) \\ / ig is rough, but should do the trick, and the pathname must be in $ 2 to use!
I hope this was clear enough!
0
a source to share