On April 21, 2004 15:01, Fajar Priyanto wrote:
Hi all,
I found out that some directories and files that I copied from windows have
777 in permission.
I tried to chmod -R 644 /directoryname, all files were correctly set into
644, but then all directories were also set into 644. I understand that
directory must be set into 755? So, how do I set all files to 644 while
also setting the directories into 755?
I tried man chmod, but the only seemed related options was -R which gave me
the wrong result.
TIA,
That's something I always thought was a deficiency of the chmod command in
Unix, thatthere's no easy way to do this. They seemed to have propagated this
deficiency to Linux. Should be an option that goes with -R, but there isn't.
There's an incantation with the find command that can do this. I can never
remember it exactly, but it's in the man pages. Something like this:
find . -type d -exec chmod 755 {} \;
where the . indicates the current directory. Put any other path there if
you're not in the directory where you want to do this. I might not have the
syntax exactly correct (could be you need a \ before the {} too).
--
Ron Hunter-Duvar
ronhd at users dot sourceforge dot net
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com
Join the Club : http://www.mandrakeclub.com