Translate file name in mapped drive to unc path filename

9 visualizaciones (últimos 30 días)
L
L el 28 de Jun. de 2022
Respondida: Jan el 29 de Jun. de 2022
Hello! Which function translates file name given in mapped drive path to file name given in UNC path? For example: z:/abc/test.m to //nettapp1/abc/test.m Thanks in advance!!
  3 comentarios
L
L el 28 de Jun. de 2022
Thanks, but I know there is a Matlab function which does this automatically. I prefer to use it.
dpb
dpb el 28 de Jun. de 2022
" I know there is a Matlab function which does this automatically..."
I don't believe there is any such thing in base MATLAB. Maybe somebody has posted something on FEX, but unless there's a java method (and I don't know that there is), capturing the output from NET USE is the ticket for a Windows box.

Iniciar sesión para comentar.

Respuestas (1)

Jan
Jan el 29 de Jun. de 2022
No, there is no Matlab command to perform this automatically.
net use sovles this and WMIC can help also:
[status, out] = system('wmic path win32_mappedlogicaldisk get deviceid, providername');
List = strsplit(out, '\n');
Line = List{startsWith(List, 'Z:')};
UNC = strtrim(Line(3:end));
Or parse the output of the PowerShell command:
Get-WmiObject Win32_NetworkConnection | where -Property 'LocalName' -eq 'Z:' | ft "RemoteName","LocalName" -A

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by