이렇게하면 현재 디렉토리와 모든 하위 디렉토리에서 .jpg 또는 .jpeg (대소 문자 구분 안 함)로 끝나는 모든 파일이 / cpjpg 디렉토리에 복사됩니다. 디렉토리 구조는 복사되지 않습니다.
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec cp '{}' /cpjpg \;
-------------------이렇게하면 디렉토리 구조가 유지됩니다.
rsync -av --include='*.jpg' --include='*/' --exclude='*' SRC DST
참조 http://logbuffer.wordpress.com/2011/03/24/linux-copy-only-certain-filetypes-with-rsync-from-foldertree/를
-------------------이렇게하면 디렉토리 구조가 유지됩니다.
find photos/ -type f \( -iname '*.jpg' -o -iname '*.jpeg' \) -print0 |xargs -0 tar c |(cd /cpjpg ; tar x)
출처
https://stackoverflow.com/questions/2002579