1. Computing & Technology
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit

ExpandUNCFileName

unit
Sysutils
category
file name utilities
declaration
function ExpandUNCFileName(const S: FileName): string;
description
Retrieves the full path and filename of a specified (relative) file using Universal Naming Convention for network files.

ExpandUNCFileName returns a fully qualified path name using Universal Naming Convention for network files. For files on local disks, ExpandUNCFileName is equivalent to ExpandFileName.
In a UNC file name, the drive prefix is replaced with the name of the network resource to which the drive is mapped. For example, if the working directory is G:\SomeSharedFolder and drive G is mapped to \\CompanyServer\AllSharedFolders ExpandUNCFileName('afile.ext') returns "\\CompanyServer\AllSharedFolders\SomeSharedFolder\afile.ext".

example

ShowMessage(ExpandUNCFileName('afile.ext'));

//displays "\\CompanyServer\AllSharedFolders\SomeSharedFolder\afile.ext"
//if the working directory is G:\SomeSharedFolder 
//and drive G is mapped to "\\CompanyServer\AllSharedFolders"
in real code
Network programming
Working with network connections from Delphi.

TNetDrive
TNetDrive is a non-visual component that connects a network path to a drive name. Full source code.

see also
ExpandFileName, ExtractFileName, FileExists,


Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

Got some code to share? Got a question? Need some help?

Discuss in my forum

©2012 About.com. All rights reserved.

A part of The New York Times Company.