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.

おすすめ記事