ksh:ディレクトリ内の特定の日付に作成されたファイルを取得する

ksh:ディレクトリ内の特定の日付に作成されたファイルを取得する

特定の日付にディレクトリ内に作成されたファイルを取得したい

> ll

total 36
-rw-rw-r--    1 tak      tak           212 Oct 08 07:06 name.log
-rw-rw-r--    1 tak      tak           494 Oct 09 09:24 rep.083011
-rw-rw-r--    1 tak      tak           494 Oct 08 05:27 rep.083221
-rwxrwxr-x    1 tak      tak           914 Oct 09 09:29 names.ksh
-rw-rw-r--    1 tak      tak           331 Oct 08 09:28 report_091020130928.txt
-rw-rw-r--    1 tak      tak           331 Oct 09 12:00 report_091020131200.txt
drwxrwxr-x    2 tak      tak          2048 Oct 08 08:44 error
-rwxrwxr-x    1 tak      tak             2 Oct 09 08:36 sample.ksh
-rw-rw-r--    1 tak      tak            92 Oct 08 06:17 x.log

私は以下のコマンドを使用しました

find . -type f -newer 2013-10-08 ! -newer 2013-10-08

エラーが発生した

find: 0652-015 Cannot access file 2013-10-07

答え1

からman find

   -newer file
          File  was  modified  more recently than file.  If file is a sym‐
          bolic link and the -H option or the -L option is in effect,  the
          modification time of the file it points to is always used.

この-newerテストでは、ファイル引数として日付文字列ではなく、正しい変更日付を持つファイルを指定するか、以下を使用することができます-mtime

   -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.
   Numeric arguments can be specified as

   +n     for greater than n,

   -n     for less than n,

   n      for exactly n.

関連情報