คำว่า newermt หมายถึงอะไรในคำสั่ง find?


14

ฉันรู้ว่าฉันสามารถใช้ตัวเลือกนี้เพื่อค้นหาไฟล์ระหว่างเวลาที่แก้ไขโดยเฉพาะ แต่ฉันอยากรู้เกี่ยวกับสิ่งนี้หมายความว่าอย่างไร

ฉันเคยman find | grep newermtพยายามหาบางอย่าง แต่ฉันไม่ได้รับเนื้อหาโดยตรง ดูเหมือน-newer fileและmtimeสิ่งต่าง ๆ อาจมีความสัมพันธ์กับมัน แต่ฉันไม่แน่ใจ..

ดังนั้นสิ่งที่-newermtจริงหมายถึงอะไร

คำตอบ:


20

find(1):

-newerXY reference
          Compares the timestamp of the current file with reference.   The
          reference  argument  is  normally the name of a file (and one of
          its timestamps is used for the comparison) but it may also be  a
          string  describing  an  absolute time.  X and Y are placeholders
          for other letters, and these letters select which time belonging
          to how reference is used for the comparison.

          a   The access time of the file reference
          B   The birth time of the file reference
          c   The inode status change time of reference
          m   The modification time of the file reference
          t   reference is interpreted directly as a time

12

find ./ -mtime +nเคยใช้เพื่อรับไฟล์ทั้งหมดที่เก่ากว่าnวัน
find ./ -mtime -nเคยใช้เพื่อแก้ไขไฟล์ทั้งหมดในnวันที่ผ่านมา
ตอนนี้ถ้าคุณใช้1แทนคุณnจะได้รับการแก้ไขไฟล์ใน 24 ชั่วโมงที่ผ่านมา แต่ถ้าคุณต้องการไฟล์จากเมื่อวานและไม่ใช่ภายใน 24 ชั่วโมงล่าสุด นี่คือnewermtภาพ

find ./ -newermt "2016-01-18" ! -newermt '2016-01-19'

จะให้ไฟล์ทั้งหมดที่ใหม่กว่าวันที่ที่ระบุและ!จะไม่รวมไฟล์ทั้งหมดที่ใหม่กว่าวันที่ที่ระบุ ดังนั้นคำสั่งดังกล่าวจะให้รายการของไฟล์ที่ถูกแก้ไขใน 2016-01-18

โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.