473,508 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sytem.IO.File.SetAttributes question

Hello,

1.1 .NET running on Windows XP...

I have read only files on my local machine. I want to use the above
SetAttributes to check OFF the readonly attribute for some of those files
because they must be writeable.
How the heck is that done??? There is a ReadOnly constant to set a file to
read only, but no constant to set a file to NOT read only (i.e. writeable).
Any help is appreciated. :-)

Thanks - Hedge
Sep 26 '05 #1
2 2134
Tony,

Get the existing attributes and create a new FileAttributes that has the
ReadOnly bit turned OFF. Then set the attributes.

Chris

"Tony Hedge" wrote:
Hello,

1.1 .NET running on Windows XP...

I have read only files on my local machine. I want to use the above
SetAttributes to check OFF the readonly attribute for some of those files
because they must be writeable.
How the heck is that done??? There is a ReadOnly constant to set a file to
read only, but no constant to set a file to NOT read only (i.e. writeable).
Any help is appreciated. :-)

Thanks - Hedge

Sep 26 '05 #2
Chris - Got it to work with your suggestion, thank you!!

"Chris McCarron" wrote:
Tony,

Get the existing attributes and create a new FileAttributes that has the
ReadOnly bit turned OFF. Then set the attributes.

Chris

"Tony Hedge" wrote:
Hello,

1.1 .NET running on Windows XP...

I have read only files on my local machine. I want to use the above
SetAttributes to check OFF the readonly attribute for some of those files
because they must be writeable.
How the heck is that done??? There is a ReadOnly constant to set a file to
read only, but no constant to set a file to NOT read only (i.e. writeable).
Any help is appreciated. :-)

Thanks - Hedge

Sep 26 '05 #3

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

Similar topics

3
26240
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
7
12220
by: John R. | last post by:
How do you set the following file attributes: Compressed Encrypted Normal ReparsePoint SparsePoint You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It doesn't work for...
0
1124
by: Next | last post by:
Hello, I am trying to uncheck the archive box and check the compress box for a given file. I am having trouble. It seems I can uncheck the archive box but nothing I've tried will check the...
1
10659
by: John Grandy | last post by:
How to remove "Read Only" status on a file on a remote server? My goal is to delete the file, but System.File.Delete(\\machine1\c$\folder1\file1.txt) is giving me an "Access is denied"...
1
1569
by: Blue Man | last post by:
Anybody has idea how to save value in web.config file during runtime? ConfigurationSettings.AppSettings.Add("test","test value"); won't work, it will cause and error : the file is read only...
4
5513
by: Debbie Carter | last post by:
Would anyone know how to read the file attributes of a file on the hard drive to check if the file is encrypted or not? I have searched Visual Studio Help and MSDN and the samples I have found do...
2
366
by: Tony Hedge | last post by:
Hello, 1.1 .NET running on Windows XP... I have read only files on my local machine. I want to use the above SetAttributes to check OFF the readonly attribute for some of those files because...
1
2416
by: Bruce Lawson | last post by:
Hi All, I've modified a simple Aspnet program from a text to show file information, including attributes and I keep getting an error which I cannot seem to solve; here's the important parts:...
6
6145
by: =?Utf-8?B?V2F5bmUgR29yZQ==?= | last post by:
Hi I want to achive 2 things. First I would like to compress an existing file on my harddrive. I can easily find out if a file is compressed or not by using "File.GetAttributes". But no matter...
0
7229
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,...
0
7129
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
7333
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,...
1
7061
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
5057
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
4716
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
3208
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...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
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.