리눅스_명령어_Life

tmpwatch

tmpwatch 라는 명령

일정 시간동안 접근이 없는 파일 삭제하기
 

yum -y install tmpwatch

 


[root@howtounix hack]# ll
total 16
-rwxr-xr-x 1 root root 8486 Aug 24 17:36 a.out
-rw-r--r-- 1 root root 1044 Aug 24 15:42 test.c

24시간 이후로 접근이 없는 파일들 삭제

[root@howtounix hack]# tmpwatch --atime 24 ./
[root@howtounix hack]# ll
total 0

 


간단하네.

       -u, --atime
              Make the decision about deleting a file based on the file’s atime (access time). This is
              the default.

              Note that the periodic updatedb file system scans keep the atime of directories  recent.

       -m, --mtime
              Make  the  decision  about deleting a file based on the file’s mtime (modification time)
              instead of the atime.

       -c, --ctime
              Make the decision about deleting a file based on the file’s ctime  (inode  change  time)
              instead of the atime; for directories, make the decision based on the mtime.

       -M, --dirmtime
              Make  the  decision about deleting a directory based on the directory’s mtime (modifica-
              tion time) instead of the atime; completely ignore atime for directories.

댓글

댓글 본문
작성자
비밀번호
graphittie 자세히 보기