![찾다. -type d -mtime +1 4일 이내에 하나의 파일만 표시 [중복]](https://linux55.com/image/156828/%EC%B0%BE%EB%8B%A4.%20-type%20d%20-mtime%20%2B1%204%EC%9D%BC%20%EC%9D%B4%EB%82%B4%EC%97%90%20%ED%95%98%EB%82%98%EC%9D%98%20%ED%8C%8C%EC%9D%BC%EB%A7%8C%20%ED%91%9C%EC%8B%9C%20%5B%EC%A4%91%EB%B3%B5%5D.png)
find
를 사용하여 24시간보다 오래된 모든 디렉토리를 찾으려고 시도했지만 -mtime +1
문제가 발생했습니다. n*24시간 분량의 데이터를 삭제해야 한다는 것을 알고 있지만 -mtime +n
삭제할 폴더는 하나만 찾는 것 같습니다 2019-07-05
. 왜 폴더를 제공하지 않나요 2019-07-06
?
find
매뉴얼 페이지 에서 :
-mtime n
File's data was last modified n*24 hours ago.
예:
[user@craptaindee mysql] find /some/folder/mysql/ -type d -mtime +1
/some/folder/mysql/2019-07-05
[user@craptaindee mysql] find /some/folder/mysql/ -type d
/some/folder/mysql/
/some/folder/mysql/2019-07-07
/some/folder/mysql/2019-07-06
/some/folder/mysql/2019-07-08
/some/folder/mysql/2019-07-05
이는 폴더의 타임스탬프입니다.
drwxr-xr-x 2 root root 4096 Jul 5 23:40 2019-07-05
drwxr-xr-x 2 root root 4096 Jul 6 23:40 2019-07-06
drwxr-xr-x 2 root root 4096 Jul 7 23:40 2019-07-07
drwxr-xr-x 2 root root 4096 Jul 8 13:00 2019-07-08
을 사용하여 작업을 수행할 수 있지만 페이지에 대해 예상한 대로 작동하지 않는 -mmin
이유를 이해할 수 없습니다 . 또한 다른 디렉터리는 표시되지 않습니다.-mtime
man
-ctime
편집: 저는 2019년 7월 8일 오후 태평양 표준시 기준 약 13시에 이 게시물을 게시하기 전에 이러한 테스트를 완료했습니다.
답변1
find 명령을 사용하여 daystart를 추가해 보세요.
find /path -type d -daystart -mtime +1