chmod operation on directories / files

2008-05-07 Thread Zbigniew Szalbot

Hello,

How do I chmod separately files and directories?

If I use chmod -R 644 then it will go through all the subdirectories 
assigning everything 644 permissions, directories including.


Many thanks!

--
Zbigniew Szalbot
www.lc-words.com


smime.p7s
Description: S/MIME Cryptographic Signature


Re: chmod operation on directories / files

2008-05-07 Thread Julien Cigar
sorry.. | xargs chmod instead of | xargs | chmod ...

On Wed, 2008-05-07 at 16:14 +0200, Julien Cigar wrote:
 find your_dir -type (f|d) | xargs | chmod ...
 
 or
 
 find your_dir -type (f|d) -exec chmod {} \;
 
 On Wed, 2008-05-07 at 13:56 +0200, Zbigniew Szalbot wrote:
  Hello,
  
  How do I chmod separately files and directories?
  
  If I use chmod -R 644 then it will go through all the subdirectories 
  assigning everything 644 permissions, directories including.
  
  Many thanks!
  
-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: [EMAIL PROTECTED]
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread Julien Cigar
find your_dir -type (f|d) | xargs | chmod ...

or

find your_dir -type (f|d) -exec chmod {} \;

On Wed, 2008-05-07 at 13:56 +0200, Zbigniew Szalbot wrote:
 Hello,
 
 How do I chmod separately files and directories?
 
 If I use chmod -R 644 then it will go through all the subdirectories 
 assigning everything 644 permissions, directories including.
 
 Many thanks!
 
-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: [EMAIL PROTECTED]
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread Zbigniew Szalbot

Hello,

Baptiste Grenier pisze:


Using find(1), you can try something like this:

For files:
  find /plop -type f -exec chmod 644 '{}' \;

For dirs:
  find /plop -type d -exec chmod 755 '{}' \;



I have recieved many helpful replies. Thank you all. The above did the trick 
for me. I have saved it for future reference!


Thanks!

--
Zbigniew Szalbot
www.lc-words.com


smime.p7s
Description: S/MIME Cryptographic Signature


Re: chmod operation on directories / files

2008-05-07 Thread Baptiste Grenier
Le 07/05/08 à 14:00, Zbigniew Szalbot téléscripta :
 Hello,

Hi,

 How do I chmod separately files and directories?

 If I use chmod -R 644 then it will go through all the subdirectories 
 assigning everything 644 permissions, directories including.


Using find(1), you can try something like this:

For files:
  find /plop -type f -exec chmod 644 '{}' \;

For dirs:
  find /plop -type d -exec chmod 755 '{}' \;

 Many thanks!

HTH,
Baptiste

-- 
Baptiste Grenier | PGP: 0x069112E2
HealthGrid SysAdmin
http://healthgrid.org/


pgp6YSoa5aV8Z.pgp
Description: PGP signature


Re: chmod operation on directories / files

2008-05-07 Thread Jonathan McKeown
On Wednesday 07 May 2008 13:56, Zbigniew Szalbot wrote:

 How do I chmod separately files and directories?

 If I use chmod -R 644 then it will go through all the subdirectories
 assigning everything 644 permissions, directories including.

Use the symbolic form for permissions and use X, which is true if any of the 
execute bits is currently set, or if the argument is a directory.

chmod -R =r,u+w,+X .

(set read for all, add user write, add all execute bits if required) should 
give you 644 on files, 755 on directories and executables.

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread Gordon devel
On Wed, May 07, 2008 at 01:56:42PM +0200, Zbigniew Szalbot wrote:
 
 How do I chmod separately files and directories?
 
 If I use chmod -R 644 then it will go through all the subdirectories 
 assigning everything 644 permissions, directories including.
 
How about?

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

If there are a lot of them, you might want to pipe to xargs.

Cheers,
Gordon
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread Valerio Daelli
Try with

find -type d -exec chmod 755 {} \;
find -type f -exec chmod 644 {} \;

Bye

Valerio Daelli

On Wed, May 7, 2008 at 1:56 PM, Zbigniew Szalbot [EMAIL PROTECTED]
wrote:

 Hello,

 How do I chmod separately files and directories?

 If I use chmod -R 644 then it will go through all the subdirectories
 assigning everything 644 permissions, directories including.

 Many thanks!

 --
 Zbigniew Szalbot
 www.lc-words.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: chmod operation on directories / files

2008-05-07 Thread Catalin Miclaus
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zbigniew
Szalbot
Sent: Wednesday, May 07, 2008 12:57 PM
To: freebsd-questions@freebsd.org
Subject: chmod operation on directories / files

Hello,

How do I chmod separately files and directories?

If I use chmod -R 644 then it will go through all the subdirectories 
assigning everything 644 permissions, directories including.

Many thanks!

-- 
Zbigniew Szalbot
www.lc-words.com




find /test -type f -exec chmod 644 {} \;

Replace /test with full path to your directory.
For directories use '-type d'.




Best Regards
Catalin Miclaus
Network/Security ISP-Data
Starcomms Ltd.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread Yi Wang
sorry, I forgot to reply to all.

for directorys, you can use:
chmod 755 */

if the files have a suffix. you can use
chmod 644 *.*

for the files don't have the suffix, I guess a regex should solve it.
But I'm not familiar with regex. :-)

On 5/7/08, Catalin Miclaus [EMAIL PROTECTED] wrote:
 -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of Zbigniew
  Szalbot
  Sent: Wednesday, May 07, 2008 12:57 PM
  To: freebsd-questions@freebsd.org
  Subject: chmod operation on directories / files

  Hello,

  How do I chmod separately files and directories?

  If I use chmod -R 644 then it will go through all the subdirectories
  assigning everything 644 permissions, directories including.

  Many thanks!

  --
  Zbigniew Szalbot
  www.lc-words.com





 find /test -type f -exec chmod 644 {} \;

  Replace /test with full path to your directory.
  For directories use '-type d'.




  Best Regards

 Catalin Miclaus
  Network/Security ISP-Data
  Starcomms Ltd.


  ___
  freebsd-questions@freebsd.org mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-questions
  To unsubscribe, send any mail to [EMAIL PROTECTED]



-- 
Regards,
Wang Yi
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread RW
On Wed, 7 May 2008 07:37:47 -0500
Gordon devel [EMAIL PROTECTED] wrote:

 On Wed, May 07, 2008 at 01:56:42PM +0200, Zbigniew Szalbot wrote:
  
  How do I chmod separately files and directories?
  
  If I use chmod -R 644 then it will go through all the
  subdirectories assigning everything 644 permissions, directories
  including.
  
 How about?
 
 find . -type d -exec chmod 755 {} \;
 find . -type f -exec chmod 644 {} \;
 
 If there are a lot of them, you might want to pipe to xargs.

Or you could  + instead of \;
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: chmod operation on directories / files

2008-05-07 Thread RW
On Wed, 07 May 2008 16:17:12 +0200
Julien Cigar [EMAIL PROTECTED] wrote:

 sorry.. | xargs chmod instead of | xargs | chmod ...

It will still fail on a directory name that contains a space (this is
a difference between Gnu and BSD).

You need:

find ... -print0 | xargs -0
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]