changing chmod for files but not directories

前端 未结 5 1597
野趣味
野趣味 2020-12-22 17:14

I need to use chmod to change all files recursivly to 664. I would like to skip the folders. I was thinking of doing something like this

ls -lR | grep ^-r |          


        
5条回答
  •  情话喂你
    2020-12-22 17:55

    My succinct two cents...

    Linux:

    $ chmod 644 `find -type f`
    

    OSX:

    $ chmod 644 `find . -type f`
    

    This works to recursively change all files contained in the current directory and all of its sub-directories. If you want to target a different directory, substitute . with the correct path:

    $ chmod 644 `find /home/my/special/folder -type f`
    

提交回复
热议问题