Page 1 of 1 1
Topic Options
#72267 - 2002-12-19 11:09 AM Rea only file..s
Jasniel Offline
Getting the hang of it

Registered: 2000-04-08
Posts: 77
In kix script, we can set a file to certain attribute, example:
$Result = SetFilAttr("C:\temp\123.doc", 1)

How can I set to include all files in c:\temp to change to read-only.

I have tried this but failed:
$Result = SetFilAttr("C:\temp\*.*", 1)
or
$Result = SetFilAttr("C:\temp\*.doc", 1)

Top
#72268 - 2002-12-20 12:09 AM Re: Rea only file..s
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Read the manual entry on Dir().

You need to iterate the directory contents and change each file.

A simple (not tested) example would be:
code:
$sFile=Dir("C:\TEMP\*.*")
While $sFile <> "" AND @ERROR=0
"Setting file C:\TEMP\" $sFile " to read only..." ?
$=SetFilAttr("C:\TEMP\" + $sFile, 1)

$sFile=Dir()
Loop

Note, you will need to add code to deal with the "." and ".." special entries, and sub-directories.

If you need to recurse subdirectories look in the UDF forum for examples.

Top
#72269 - 2002-12-19 03:52 PM Re: Rea only file..s
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Why do you want to do that? This will prevent applications to clean up after themselves as they no longer have the rights to delete the files they created in the temp directory.

Additionally, please go into the UDF Forum and take a look at any of the DIR UDFs which will enable you to enumerate files/folders.
_________________________
There are two types of vessels, submarines and targets.

Top
#72270 - 2002-12-20 01:51 AM Re: Rea only file..s
ElegantSol Offline
Fresh Scripter

Registered: 2002-11-28
Posts: 34
Loc: Cranbury, NJ, USA
Jens

You refer to the UDF Lib in your signature, but it points to the BBS discussions not a UDF lib. Do you me to point to:
KiXtart UDF LIB [Confused]
?

Steve

[ 20. December 2002, 01:53: Message edited by: ElegantSol ]
_________________________
Stephen If the solution to the problem be concise and artfully or ingeniously contrived yet simple and handsome in effect, then the solution merits the adjective elegant. -- K.G. Wilson

Top
#72271 - 2002-12-20 02:19 AM Re: Rea only file..s
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The UDF link in Jens' sig line points to the UDF forum on this board. That forum is the source for link you pointed to and is also the one in my signature line.

[ 20. December 2002, 02:20: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#72272 - 2002-12-20 02:38 AM Re: Rea only file..s
ElegantSol Offline
Fresh Scripter

Registered: 2002-11-28
Posts: 34
Loc: Cranbury, NJ, USA
I was just trying to be helpful to Jasniel because the link Jens refers to contains no DIR UDF'S.

I was just suggesting that he rename the UDF LIB link to FORUM and add a link to the full lib at
the address I indicated.

Maybe the the index is still corrupt and the uds's do not show, but just take a look and see what I mean.

Steve

[ 20. December 2002, 02:40: Message edited by: ElegantSol ]
_________________________
Stephen If the solution to the problem be concise and artfully or ingeniously contrived yet simple and handsome in effect, then the solution merits the adjective elegant. -- K.G. Wilson

Top
#72273 - 2002-12-20 02:41 AM Re: Rea only file..s
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
It is the full library. The default view only displays 10 days of posts but it can display them all if you select that from the drop down list. I do prefer to use the links in my signature line though.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#72274 - 2002-12-20 02:47 AM Re: Rea only file..s
ElegantSol Offline
Fresh Scripter

Registered: 2002-11-28
Posts: 34
Loc: Cranbury, NJ, USA
Thanks Howard,

I did not realize how it was set up, but then again i'll bet some other newbies will also not realize this either.

The other link was just catagorized nicer.

Steve
_________________________
Stephen If the solution to the problem be concise and artfully or ingeniously contrived yet simple and handsome in effect, then the solution merits the adjective elegant. -- K.G. Wilson

Top
#72275 - 2002-12-20 02:52 PM Re: Rea only file..s
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I have updated my signature to also point to the sorted collections. It should also automatically switch to displaying ALL UDFs ever posted in the UDF Forum when using my signature link to the UDF Forum!

For those curious, here's the actual link: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=forum&f=12&DaysPrune=1000&submit=Go

Please note the 'DaysPrune' and 'Submit' parameters!

[ 20. December 2002, 14:55: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 978 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.057 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org