2015-12-07 104 views
0

我有一個包含一些文件和子目錄的目錄。在該目錄中,我需要按名稱格式「.cm-2015.10.10」查找超過30天的文件。此命令找到我所需要的目錄:按名稱查找超過60天的目錄

find comdit/ -type d -name .cm-[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9] -print 

,但我怎麼可以指定我只需要60天以前的文件夾?添加-ctime +60對我沒有任何幫助。我究竟做錯了什麼?

回答

0

這是-mtime您正在尋找:

find comdit/ -type d -mtime +30 -name .cm-[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9] -print 

下面是文檔:

-atime n 
      File was last accessed n*24 hours ago. When find figures out 
      how many 24-hour periods ago the file was last accessed, any 
      fractional part is ignored, so to match -atime +1, a file has to 
      have been accessed at least two days ago. 

    -ctime n 
      File's status was last changed n*24 hours ago. See the comments 
      for -atime to understand how rounding affects the interpretation 
      of file status change times. 

    -mtime n 
      File's data was last modified n*24 hours ago. See the comments 
      for -atime to understand how rounding affects the interpretation 
      of file modification times. 
+0

謝謝,現在的作品! – user2445291