Check if file/folder is on a network drive
gregorK
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
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:
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.
December 6, 2015 at 10:41 am - Permalink
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
December 6, 2015 at 05:27 pm - Permalink
Enter this in your procedure window to load the "WaitForFileProcs" WaveMetrics procedure file:
December 6, 2015 at 06:09 pm - Permalink
Gregor
--
Gregor K
ALOISA Beamline
Elettra Synchrotron
December 6, 2015 at 11:23 pm - Permalink
I wanted to suggest using
GetFileFolderInfo
but that seems to not return the writeable state on mac.December 7, 2015 at 06:16 am - Permalink