473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is it a mapped network drive ?

Given a full path (C:\Dir1\Dir2\... or \\host\dir1\dir1 etc.), How can I
tell if the root drive of the path is a local drive or mapped network drive?
--------
Thanks
Sharon
May 10 '06 #1
4 5707
Sharon,

Use the DriveInfo class in the System.IO namespace. You can pass the
drive letter to the constructor. Then, check the DriveType property to see
if it equals DriveType.Network.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:6B**********************************@microsof t.com...
Given a full path (C:\Dir1\Dir2\... or \\host\dir1\dir1 etc.), How can
I
tell if the root drive of the path is a local drive or mapped network
drive?
--------
Thanks
Sharon

May 10 '06 #2
I think the System.IO.DriveInfo class exists only in the .NET 2.0, but I'm
using the 1.1 version.
Am I right?

For now I'm using the corresponding Win32 API function GetDriveType() in the
kernel32.dll and it works nicely.

--
Thanks
Sharon
May 10 '06 #3
Hi Sharon,

Yes, System.IO.DriveInfo class only exists in .NET framework 2.0. In 1.1,
the only workaround is to use PInvoke to call GetDriveType() function.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 11 '06 #4
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> writes:
Sharon,

Use the DriveInfo class in the System.IO namespace. You can pass the
drive letter to the constructor. Then, check the DriveType property to see
if it equals DriveType.Network.


Even in .NET 2.0, it seems that DriveInfo is unable to handle mount
points at all. Or am I missing something?

Best regards,
Martin
May 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AMD | last post by:
Hi, I would like to have MySQL use a mapped network drive. I'd like to do this in case there is a failure of the mysql machine, I can just replace it with a new machine pointing to the same...
2
by: giloosh99 | last post by:
Hello, Im grabbing tables via VB code using visual foxpro ODBC drives. The tables directory is in a mapped network drive. The code works fine and does the job, however if the computer is idle for...
5
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
2
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple...
4
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new...
1
by: ArunRJ | last post by:
Hi All, I am new to the networking field. I recently had to share a folder in a Windows XP machine A with another XP machine B. The folder in machine A has some .xls files which I need to access...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am trying to accesss a Mapped Drive from my asp.net code running on IIS 6.0. I am using a FileUpload control and fileUpload.SaveAs() to save the file to the server. I want to save the file to...
1
by: dkultasev | last post by:
Hello, I developed the program for multi use. The program reads data from the text file and puts modified data back to another file. This program was uploaded to mapped network drive. When I try...
0
abdoelmasry
by: abdoelmasry | last post by:
Hi Profs I need help to rename Mapped network Drive i use patch file that contains the command SUBST to set map network drives for our domain clients. the mapped network drive is already...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.