C.W.K.
Stream
Lesson 06 of 12 · published

파일 Exclude

~12 min · rsync, exclude, rsyncignore

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

Cruft 건너뛰기

프로젝트를 그대로 sync 원하는 거 거의 없어. node_modules, .git, build 산출물, .DS_Store, __pycache__, 로그 파일 — 다 노이즈. Exclude 가 전송 빠르게, 공간 절약, 의도 안 한 target 쪽 상태 덮어쓰기 회피.

두 방법 — inline 과 .rsyncignore 스타일

일회성은 패턴별 inline --exclude. 프로젝트 작업은 패턴 파일에 두고 --exclude-from=. gitignore 비슷한 구문 — 앞 / 가 source root 에 anchor, 뒤 / 가 디렉토리 매치, * 가 glob.

Code

Inline exclude·bash
rsync -avz \
  --exclude '.git' \
  --exclude 'node_modules' \
  --exclude '*.log' \
  --exclude '.DS_Store' \
  --exclude '__pycache__' \
  --exclude '.venv' \
  ./project/ host:/dest/
파일에서 (정돈된 방법)·bash
# .rsyncignore at the source root
cat > .rsyncignore <<'EOF'
.git
node_modules
.next
dist
build
*.log
.DS_Store
.env
__pycache__
*.pyc
.venv
.pytest_cache
EOF

# Use it
rsync -avz --exclude-from='.rsyncignore' ./project/ host:/dest/

External links

Exercise

진짜 프로젝트 골라. Exclude 없이 — rsync -avzn ./project/ host:/tmp/x/ | wc -l — rsync 가 만질 파일 수. 그다음 --exclude '.git' --exclude 'node_modules' 로 — 새 수 메모. 차이가 매 sync 마다 안 그럼 낭비할 대역폭과 시간.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.