
japhy
Enthusiast
Mar 8, 2000, 9:23 AM
Post #2 of 3
(334 views)
|
|
Re: Setting directory and file permissions via ftp...
[In reply to]
|
Can't Post
|
|
If you don't want to recurse down into directories that the directory contains, you can use: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> $path = "/path/to/dir"; $mode = 0777; opendir DIR, $path or die "can't open $path: $!"; while (defined($file = readdir DIR)) { chmod $mode, "$path/$file" or warn "can't chmod $mode $path/$file: $!"; } closedir DIR; </pre><HR></BLOCKQUOTE> Or you can just use the glob() function (or the <...> operator): <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> chmod $mode, glob("$path/*"); # or chmod $mode, <$path/*>; </pre><HR></BLOCKQUOTE> [This message has been edited by japhy (edited 03-08-2000).]
|