茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1671289 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_2400176.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2019/1/4 7:26:53

Linux / Unix: Find Files Modified On Specific Date

How do I find out all files that have been modified on 2013-02-07 (07/Feb/2013) using find command under Linux / Apple OS X / *BSD and Unix like operating systems?

There are two ways to list files in given directory modified after given date of the current year. The latest version of GNU/find command use the following syntax:

Syntax

GNU/find latest version:
find /path/to/dir -newermt "date"
find /path/to/dir -newermt "Feb 07"
find /path/to/dir -newermt "yyyy-mm-dd"
## List all files modified on given date
find /path/to/dir -newermt yyyy-mm-dd ! -newermt yyyy-mm-dd -ls
### print all *.pl ###
find /path/to/dir -newermt "yyyy-mm-dd" -print -type f -iname "*.pl"

Sample outputs:


Fig.01: Find -newermt yyyy-mm-dd in action
Fig.01: Find -newermt yyyy-mm-dd in action

The other way of doing this works on the versions of find before v4.3.3:



touch -t 02010000 /tmp/stamp$$
find /usr -newer /tmp/stamp$$
rm -f /tmp/stamp$$

Examples


To find out all files that have been modified on 2013-02-07 (07/Feb/2013), enter:

2013-02-08

find /path/to/dir -type f -name "*" -newermt 2013-02-07 ! -newermt 2013-02-08

Sample outputs:


./output/tmp/rss.js-gzip-10881623-407-1360173602
./images/advanced-cache.php
./images/faq/2013/02/ir-150x150.jpg
./images/faq/2013/02/warning-40px76.png

To find out all Python files (*.py) in /home/vivek/projects that have been modified on 2013-02-07 (07/Feb/2013), enter:

-print

find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -print

Pass the -ls option to get detailed file listing:

-ls

find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -ls

To find and delete all tmp files (*.tmp) in /home/vivek/projects that have been modified on 2013-02-07 (07/Feb/2013), enter:

-delete

find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -delete



原文出處:Linux / Unix: Find Files Modified On Specific Date - nixCraft
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|