chmod 명령에서 file 속성만 바꾸려면?

byulbee의 이미지

안녕하세요?
chmod 명령어에서 하위 디텍토리와 파일이 여러게 있을 때,
디렉토리는 현재 상태를 유지 하고,
일반 파일의 속성만 바꿀 수 있나요?

그냥 chmod -R 755 aaa
하면 파일 속성도 모두 755로 바뀌고,
chmod -R 644 aaa
하면 디렉토리 속성도 모두 644로 바뀌는데,
디렉토리는 755로 유지 한 채 파일만 644로 바꾸고 싶은데,
어떻게 하면 되나요?

jg의 이미지

파일이 많고 이름에 공백이 있을 경우

find -type f | while read file; do chmod 644 "$file"; done

또는 xargs 를 이용한 방법

find -type f | xargs chmod 644

파일이 많지 않고 파일이름에 공백이 없을 경우

chmod 644 `find -type f`

--
perl -e's@@JEON Myoung-jin@;sub man{s| _|her e|}
sub see{s;^;Just;;u;s;e ;Perl ;;to;print$_,$/}$uperMan=M;
s=^....=U are not=;s~$uperMan~~;&admitIt;s=U are = A=;s|young|_|;&man;
sub admitIt{say;ye;s!-\w+! Hacker!};see U'

$Myoungjin_JEON=@@=qw^rekcaH lreP rehtonA tsuJ^;$|++;{$i=$like=pop@@;unshift@@,$i;$~=18-length$i;print"\r[","~"x abs,(scalar reverse$i),"~"x($~-abs),"]"and select$good,$day,$mate,1/$~for 0..$~,-$~+1..-1;redo}

byulbee의 이미지

jg님. 감사합니다.

이렇게 좋은 방법이 있었군요.

좋은 하루 되세요!!