Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > checking file's permissions and change them

checking file's permissions and change them
Thread Tools
Fresh-Faced Recruit
Join Date: Apr 2005
Status: Offline
Reply With Quote
Apr 9, 2005, 11:11 PM
 
Hi all,

I need to write a shell script to recursively search a directory tree containing subdir and files. then the program will check the file's permissions and change them if necessary.


I have a very little background and experience with shell scripting and really don't know to do it.

Please let me know if you can help. I do really need your help,

not using find command

Please advise.

Thanks
     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 10, 2005, 04:49 AM
 
Why can't you use the find command?

Incidentally, the best source of information I've found about bash scripting is Mendel Cooper's Advanced Bash-Scripting Guide. It's absolutely invaluable.
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 10, 2005, 08:21 PM
 
Originally posted by wataru:
Why can't you use the find command?

Incidentally, the best source of information I've found about bash scripting is Mendel Cooper's Advanced Bash-Scripting Guide. It's absolutely invaluable.
Yes, that tutorial is awesome, but the `find` command's permissions stuff is confusing as hell. I recall trying to figure it out how to use find's "+perm" and "-perm" once, but it ended up getting lost.

"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 10, 2005, 09:06 PM
 
Can't you just use -exec chmod blah?
     
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 10, 2005, 10:37 PM
 
Originally posted by wataru:
Can't you just use -exec chmod blah?
He wants to find files/directories with certain permissions. I suppose you could look at the output of `ls -l` and parse that, but that sounds pretty ugly. I never could figure out the permissions primary for find ("+perm" and "-perm"). Going between BSD find and GNU find also has some inconsistencies, especially with the permissions primary.
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:16 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2