#72267 - 2002-12-19 11:09 AM
Rea only file..s
|
Jasniel
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
   
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
|
|
|
|
#72271 - 2002-12-20 02:19 AM
Re: Rea only file..s
|
Howard Bullock
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 ]
|
|
Top
|
|
|
|
#72272 - 2002-12-20 02:38 AM
Re: Rea only file..s
|
ElegantSol
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
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.
|
|
Top
|
|
|
|
#72274 - 2002-12-20 02:47 AM
Re: Rea only file..s
|
ElegantSol
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 895 anonymous users online.
|
|
|