• <dl id="2u8ki"><small id="2u8ki"></small></dl>
    • <rt id="2u8ki"><em id="2u8ki"></em></rt>
    • <menu id="2u8ki"></menu>
      0712-2888027 189-8648-0214
      微信公眾號(hào)

      孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號(hào)

      當(dāng)前位置:主頁 > 技術(shù)支持 > Linux > Linux查找某時(shí)間段內(nèi)的所有文件并將結(jié)果輸出到文件

      Linux查找某時(shí)間段內(nèi)的所有文件并將結(jié)果輸出到文件

      時(shí)間:2018-05-24來源:風(fēng)信官網(wǎng) 點(diǎn)擊: 1514次
      利用grep命令和tee命令能夠查找Linux某時(shí)間段內(nèi)的所有文件并將結(jié)果輸出到文件,這樣通過查看輸出的文件,我們可以判斷那些文件被修改過。

      1.如果是精確到天

      如:在1-20天內(nèi)修改過的文件,并將結(jié)果輸出到20180524.log文件中

      find /www_ithov_net/public_html -mtime +1 -a -mtime -20 -type f | tee -a /www_ithov_net/public_html/20180524.log
      Linux查找某時(shí)間段內(nèi)的所有文件并將結(jié)果輸出到文件

      2.精確到時(shí)分秒

      如:在2015年5月10日內(nèi)的文件

      方法一:

      touch -t 201505100000 t_start;touch -t 201505102359.59 t_end;find . -type f -newer t_start ! -newer t_end | xargs ls -l | grep -v "t_start\|t_end";rm -f t_start;rm -f t_end;

      先創(chuàng)建兩個(gè)時(shí)間結(jié)點(diǎn)文件;查找時(shí)間結(jié)點(diǎn)范圍內(nèi)的文件(-newer   f1 !f2               #查更改時(shí)間比f1新但比f2舊的文件);過濾文件;刪除臨時(shí)文件t_start,t_end;

      方法二:

      find  -type f −newermt′2015−05−1000:00′−a−not−newermt′2015−05−1023:59′


      (     注意在-newermt前面有(  ,在末尾有)   , csdn編輯反斜杠大括號(hào)不顯示???)
      熱門關(guān)鍵詞: Linux 查找 時(shí)間段 文件 輸出文件
      欄目列表
      推薦內(nèi)容
      熱點(diǎn)內(nèi)容
      展開
      中文字幕无码AV黄片,亚洲天堂日本美女,国产亚洲色婷婷久久99精品91,午夜无码不卡视频 99久色图精品国产 精品熟女少妇A∨免费久久
    • <dl id="2u8ki"><small id="2u8ki"></small></dl>
      • <rt id="2u8ki"><em id="2u8ki"></em></rt>
      • <menu id="2u8ki"></menu>