![ksh:特定の日に作成されたファイルをディレクトリから取得します。 [重複]](https://linux33.com/image/51199/ksh%EF%BC%9A%E7%89%B9%E5%AE%9A%E3%81%AE%E6%97%A5%E3%81%AB%E4%BD%9C%E6%88%90%E3%81%95%E3%82%8C%E3%81%9F%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%E3%83%87%E3%82%A3%E3%83%AC%E3%82%AF%E3%83%88%E3%83%AA%E3%81%8B%E3%82%89%E5%8F%96%E5%BE%97%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%20%5B%E9%87%8D%E8%A4%87%5D.png)
特定の日に作成されたファイルをディレクトリに保存したいと思います。
> 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.