달력

22025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

자주 사용되는 옵션을 정리한해봄.

 

-type   : 디렉터리 , 파일 구분해서 찾을때 

       d  :  디렉터리 

       f   :  파일 

-size    :  파일 사이즈 

-ctime  : 일단위

-mmin : 분단위   

# 일정 날짜가 지난거 찾을때

# 파일 생성일이 최근 30분 안에 생긴거 찾기
shell >$  find ./ -type f -mmin -30

# 디렉터리가 생성된게 30일 지난거 찾기
shell >$  find ./-type d -ctime +30

 

# 특정 파일 사이즈 이상되는거 찾기

# 1k 이상되는 파일 삭제 
shell >$  find ./ -type f -size +1k -delete

# -exec 활용 
shell >$  find ./ -depth -type f -size +1k  -exec rmdir {} \;

 

# 디렉터리 안에 파일이 하나도 없는것 삭제 

shell >$  find ./ -type d -empty -delete

# -exec 활용 
shell >$  find ./ -depth -type d -empty -exec rmdir {} \;

 

Posted by 염불법사
|