473,667 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sytem.IO.File.S etAttributes 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 2155
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
26259
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
7
12244
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 these file attributes.
0
1132
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 compress box. Would someone point me in the right direction? I have no idea what I am doing wrong.
1
10666
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" error. My log-on account is member of MACHINE1's local Administrators group.
1
1578
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 during rumtime.
4
5521
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 not work. Any help would be appreciated. I am using VB.NET
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 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. :-)
1
2430
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: Imports System Imports System.IO Imports System.IO.DirectoryInfo Imports System.IO.File Imports System.IO.FileAttributes ............
6
6157
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 what I do I simply can't set the compressed attribute using "SetAttributes". I have no problem setting the attributes "Read-Only", "Archive" or "Hidden" using "SetAttributes"!
0
8365
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8563
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6203
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4200
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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 we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.