?
Solved

Setting file attribute

Posted on 1999-07-25
4
Medium Priority
?
178 Views
Last Modified: 2010-04-04
Hi,

I have a problem to set file attribute.  I want to clear read-only attribute from a file which has read-only attribute.
HOw to do this? Thank you very much for your help.

Regards cah
0
Comment
Question by:Hencah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Epsylon earned 0 total points
ID: 1391129
Example:

SetFileAttributes('File.txt', FILE_ATTRIBUTE_READONLY or FILE_ATTRIBUTE_HIDDEN);

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1391130
Veru quick Epsylon, but wrong I think... :-)

Cheers,

Raymond.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1391131
To clear the read-only attribute:

var attr: DWORD;
begin
  attr := GetFileAttributes('file.txt');
  SetFileAttributes('File.txt', attr and not FILE_ATTRIBUTE_READONLY);
end;

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1391132
I don't think the first piece of code would work, but the second one sure will ;-)

..-=ViKtOr=-..
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question