Check if file/folder is on a network drive

Hi!

Is there any way to tell if a given file or folder is on a network drive, i.e. not on the local computer?
I need to make a local copy of a network (remote) file before working on it in my procedure/XOP (mainly because there is no write access to the remote machine/drive).
It would be nice if it is possible to check this within IGORs built-in function therefore being platform independent (Mac or Win).

Thanks for your help!

Gregor
I can not think of a foolproof way to do this.

On Windows, the path to a folder on a server will start with \\server\share unless the user has mapped it to a drive letter in which case it might not start with \\server\share. Execute this for relevant information:
DisplayHelpTopic "UNC Paths"


On Macintosh, a volume that is not the root volume will start with "/Volumes". However this does not provide a way to distinguish a server volume from a local volume.
I get this for Mac OS when I search ...

https://developer.apple.com/library/mac/qa/nw09/_index.html

I would imagine an equivalent exists for Windows (left as an exercise for folks on that side of the fence).

Perhaps this info could be built into an Igor Pro function some day (ParseFilePath ... mode 9 --> returns 0 if local, 1 if networked).

I might suggest two work-arounds ...

* Since you have no write access to the network, can you do a test to the folder level of the file to try to write a dummy file, and then, when it fails, assume that folder is a network (i.e. the file is a network file).

* Write the file copy always and give it date+time stamp version numbers.

--
JJW


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
You may be able to use the WaitForWriteAccesToFile function in the "WaitForFileProcs" WaveMetrics procedure file, or a variation on it, to determine if you can write to a particular path.

Enter this in your procedure window to load the "WaitForFileProcs" WaveMetrics procedure file:
#include <WaitForFileProcs>

Thank you both for your suggestions. I have just found the GetDriveType function in the Windows API. I agree with jjweimer, maybe you could add a new function/option to check if a file is local or not (perhaps in GetFileFolderInfo)? Anyways I will try to code both mac and win functions to a XOP to determine whether a file is local or not.

Gregor

--
Gregor K
ALOISA Beamline
Elettra Synchrotron
gregorK wrote:

I need to make a local copy of a network (remote) file before working on it in my procedure/XOP (mainly because there is no write access to the remote machine/drive).


I wanted to suggest using GetFileFolderInfo but that seems to not return the writeable state on mac.