System/Linux
linux - 특정 디렉토리 및 파일만 chmod 실행
linuxism
2013. 11. 8. 15:51
파일만
find ./ -type f -exec chmod -v 644 {} \;
폴더만
find ./ -type d -exec chmod -v 755 {} \;
해당파일만
find ./ -type d -name 파일이름 -exec chmod -v 755 {} \;
해당파일을 제외하고
find ./ -type d \! -name 파일이름 -exec chmod -v 755 {} \;
해당폴더만
find ./ -type d -name 폴더이름 -exec chmod -v 755 {} \;
해당폴더를 제외하고
find ./ -type d \! -name 폴더이름 -exec chmod -v 755 {} \;
여기서 주의해야 할 사항은 {} 과 \ 사이에는 꼭 공백을 넣어야 합니다.
안그러면 아래와 같은 에러가 뜹니다.
find: missing argument to `-exec'
파일과 폴더를 모두 한꺼번에 변경 할 때는 아래와 같이 합니다.
chmod -R 755 *
해보지는 않았지만 chown 소유자명 변경도 잘 적용 될까나???
출처 - http://supermono.tistory.com/53