473,499 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking Drives for ReadOnly

Some time ago, I posed a queston in this newsgroup regarding how to determine
if a drive was readonly. The only way I had found was to try to create a
directory or file then chedk if an error was encountered. The replies were
that this was acceptable. However, it takes time to do this. Since I found
a way, which probably most know already but for those new to VB.Net, here it
is:

'Note r is a string equal to root directory on drive being checked, i.e.,
"d:\"
If (new directoryinfo(r).attributes and fileattributes.ReadOnly) > 0 then
'drive/storage is readonly
Else
'drive/storage can be written to
End If
--
Dennis in Houston
Nov 21 '05 #1
0 940

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

Similar topics

1
1591
by: Travis L. Alltop | last post by:
All, To make a long story short, we are swapping out the "knock-off" drives that the NA purchased on E-Bay in one of our production SQL Servers (SQL Server 2000 Enterprise) this weekend for...
0
354
by: Dennis | last post by:
Trying to check if a drive is writable. Can do it by trying to create a directory using DirectoryInfo class then checking err.number but looking for a more elegant way. Tried...
36
3914
by: Ron Johnson | last post by:
http://hardware.devchannel.org/hardwarechannel/03/10/20/1953249.shtml?tid=20&tid=38&tid=49 -- ----------------------------------------------------------------- Ron Johnson, Jr....
2
3074
by: Jarod_24 | last post by:
What is wrong here. This thing allways returns true. I want a simple way to see if a file is write protected. 'strFilename' holds the path for the file Dim isWriteProtected As Boolean =...
0
2317
by: Dennis | last post by:
I have tried to use the IWshRuntimeLibrary and ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk") to get all Logical Drives, Mapped Network Drives, Shared Folders and Shared Drives with...
2
1925
by: ImOk | last post by:
WHen I run this under Windows I get the Count of drives but then I get an error message on the Reset() when I try to enumerate. Does this work for anyone? $fs = new...
4
1368
by: Stefan | last post by:
Hello, vb.net /MSDE question I have a form to add a new record.When Save buttton is pushed,the record is saved to the database,but i don't know how to get the new id back in my dataset...
1
4130
by: ledneh | last post by:
I've been working on concurrency checking for an application I'm building, and a minor part of it has me slightly stumped. I've got a DetailsView that populates from an ObjectDataSource, using...
8
2403
by: Salad | last post by:
I was asked to get my daughter a flash drive. She needs to use it to copy files to it so she can transfer the files at school to her desktop at home. I've never used one but I figure some of...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3105
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.