Results 1 to 5 of 5

Thread: chmod command

  1. #1
    Join Date
    Feb 2004
    Posts
    143

    Unanswered: chmod command

    Hello
    chmod 777 *.sh will alter permissions to all .sh files in the current directory.
    Now, if I have lot of sub-directories and a lot of .sh files in all those sub-directories, while sitting in the parentmost directory, how can I alter
    permissions using chmod all on one shot ??
    Is there some flag/options to use so that not only my in my current directory .sh files but also all sub directory .sh files permissions will be changed. Thanks

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    chmod -R *.sh
    or
    man find

  3. #3
    Join Date
    Feb 2004
    Posts
    143
    Hello,
    I tried this. I have 2 problems -

    1. I am in a directory called biotox. There are 15 sub directories beneath it.
    Again these 15 sub directories have other directories beneath it too.
    Now sitting in biotox directory, i tried to issue the chmod -R 777 *.sh ( to change permissions for all sh files in all sub directories.
    The issue is actually the biotox directory doesn't have any .sh files under it . They are only in all the sub-directories. So I get

    chmod: *.sh: A file or directory in the path name does not exist.


    2. I went into a sub-directory called aaa under biotox where there are .sh files. I did chmod -R 777 *.sh
    It changed the permissions for all .sh files directly under aaa directory but not the .sh files in the sub directories of aaa
    How do I achieve this ? Am I going somewhere wrong ? Or could it be OS specific ?
    I am on AIX 5.1

    Thanks

  4. #4
    Join Date
    Mar 2003
    Posts
    23
    Try find . -name "*.sh" -exec chmod 777 {} \;

  5. #5
    Join Date
    Feb 2004
    Posts
    143
    Great...that worked. Thanks a million

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •