how to chmod php files without chmod subdirectory?

Discussion in 'HOWTO-Related Questions' started by dealspiggy, Sep 5, 2008.

  1. dealspiggy

    dealspiggy New Member

    When there are several layers of subdirectories in a main subdirectory (e.g. main/subdir1/subdir2/subdir3/) and each subdirectory has many php files, I wonder how to chmod those php files to 644 without chmoding subdirectories?

    chmod -R 644 main ?? But this also chmod subdirectories to 644, how do I add a condition to this chmod ?
  2. daveb

    daveb Member

    To chmod all your files below a dir to 644 use this:
    find /path/to/dir/ -type f -print0 | xargs -0 chmod 644
    if you want to chmod all sub dir below a dir to say 755 try this
    find /path/to/dir/ -type d -print0 | xargs -0 chmod 755

Share This Page