preserving file permissions?
[1/4] from: notofo::earthlink::net at: 22-Mar-2004 20:40
Hey guys,
will using the /binary refinements of read and write
preserve file permissions exactly?
I'd like to write something to copy my home directory into
an arbitrary number of directories. I want all the hidden
files, and all the permissions preserved.
has anyone done this already?
thanks!
--
signature flying: "whoosh!"
-tom
[2/4] from: g:santilli:tiscalinet:it at: 23-Mar-2004 15:33
Hi Tom,
On Tuesday, March 23, 2004, 2:40:25 AM, you wrote:
TF> will using the /binary refinements of read and write
TF> preserve file permissions exactly?
Nope. You can use:
clone-attributes: func [dest src /local modes] [
modes: context get-modes src get-modes src 'file-modes
; workaround for a bug in SET-MODES
modes/modification-date: modes/modification-date - 0:00:02
set-modes dest third modes
]
You could need the workaround depending on your platform. If you
don't need it, the function can be reduced to:
clone-attributes: func [dest src] [
set-modes dest get-modes src get-modes src 'file-modes
]
(You can't rely too much on modification-date anyway on Windows,
as it looks like it just does not have enough precision.)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[3/4] from: greggirwin:mindspring at: 23-Mar-2004 10:35
GS> clone-attributes: func [dest src] [
GS> set-modes dest get-modes src get-modes src 'file-modes
GS> ]
Do you want to use 'file-modes or 'copy-modes? I'm not sure what all
the differences are in current releases; 'full-path might be returned
on some systems. It looks like current Windows releases don't return
it, even for 'file-modes where it should.
In any case, you'll need to remove 'full-path if it comes back in the
list of modes or it will cause an error when you try to use it with
set-modes.
-- Gregg
[4/4] from: g:santilli:tiscalinet:it at: 23-Mar-2004 19:02
Hi Gregg,
On Tuesday, March 23, 2004, 6:35:51 PM, you wrote:
GI> Do you want to use 'file-modes or 'copy-modes? I'm not sure what all
Probably it should be 'copy-modes... I haven't had any problems so
far using 'file-modes on Windows, though...
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/