in reply to How does rename() work on read-only files?
how rename() actually works on read-only files just went over my head.
rename doesn't modify any files; it modifies a directory or two. As long as you have write access to the source and destination directories, you can rename the file.
$ touch foo $ chmod 0 foo $ ls -li total 0 11314128152 ---------- 1 ikegami pg1404028 0 Dec 11 10:11 foo $ perl -e'rename("foo", "bar") or die $!' $ ls -li total 0 11314128152 ---------- 1 ikegami pg1404028 0 Dec 11 10:11 bar $ chmod a-w . $ perl -e'rename("bar", "baz") or die $!' Permission denied at -e line 1. $ ls -li total 0 11314128152 ---------- 1 ikegami pg1404028 0 Dec 11 10:11 bar
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How does rename() work on read-only files?
by j41r (Beadle) on Dec 11, 2018 at 10:55 UTC | |
by ikegami (Patriarch) on Dec 11, 2018 at 18:14 UTC | |
by j41r (Beadle) on Dec 12, 2018 at 00:17 UTC |