How to... read file permissions?
[1/3] from: al::bri::xtra::co::nz at: 20-Jul-2002 19:11
I can make a file read only with:
>> write/allow %Test.txt "Test is read only" [read]
And to check:
>> delete %Test.txt
** Access Error: Cannot delete Test.txt
** Where: throw-on-error
** Near: delete %Test.txt
Now I read a random file:
>> read %"Random File.txt"
== "Hello! I'm a random file!^/"
How can I find out through Rebol (without writing to %"Random File.txt" and
potentially destroying it's contents) if the file is read only?
Andrew Martin
Read-ing & Write-ing the Rebolution...
ICQ: 26227169 http://valley.150m.com/
[2/3] from: anton::lexicon::net at: 20-Jul-2002 19:13
Re: How to... read file permissions? - get-modes & set-modes
Hi Andrew,
get-modes is what you want:
>> get-modes %user.r 'file-modes
== [creation-date access-date modification-date owner-write archived hidden
system]
>> get-modes %user.r [owner-write] ; a block, so you can get several at a
time
== [owner-write: true]
There is also 'set-modes.
Also check out:
http://www.lexicon.net/anton/rebol/util/demo-show-file-modes.r
http://www.lexicon.net/anton/rebol/util/show-file-modes.r
Anton.
[3/3] from: al:bri:xtra at: 21-Jul-2002 10:03
Thanks, Anton!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
-><-
----- Original Message -----
From: "Anton Rolls" <[anton--lexicon--net]>
To: <[rebol-list--rebol--com]>
Sent: Saturday, July 20, 2002 9:13 PM
Subject: [REBOL] Re: How to... read file permissions? - get-modes &
set-modes