Cosa significa newermt nel comando find?


14

So che posso usare questa opzione per trovare il file tra determinati orari modificati. Ma sono curioso di sapere cosa significa?

Cercavo man find | grep newermtdi trovare qualcosa. Ma non ho contenuti diretti. Sembra -newer filee mtimeroba può avere relazione con esso. Ma non sono sicuro..

Quindi, cosa significa in -newermtrealtà?

Risposte:


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 +nutilizzato per ottenere tutti i file più vecchi dei ngiorni
find ./ -mtime -nutilizzato per ottenere tutti i file modificati negli ultimi ngiorni
Ora se si utilizza 1al posto di n, si otterranno i file modificati nelle ultime 24 ore. E se volessi solo i file di ieri e non nelle ultime 24 ore? Qui newermtentra in scena.

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

ti darà tutti i file più recenti della data specificata ed !escluderà tutti i file più recenti della data specificata. Quindi il comando precedente fornirà un elenco di file che sono stati modificati il ​​18-01-2016.

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.