 |
 |
checking file's permissions and change them
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2005
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
Can't you just use -exec chmod blah?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status:
Offline
|
|
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"
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|