Ind -mtime +0 0-0 time problem added. TXT
Find -mtime +N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N Find -mtime +N = < current time -(N+1) days; find -mtime +N = < current time -(N) days
–// In other words, +0 0-0 indicates: Find -mtime +0 = < current time -(1) days; find -mtime +0 = < current time -(1) days; find -mtime +0 = < current time -(0) days;
–// To strengthen your memory, test:
$ mkdir aaa
$ cd aaa
$ date “+%Y%m%d%H%M.%S.%N”; Seq – 2 1 2 | xargs – IQ date “+ % Y m. H % m % d % % % S” – the date = ‘Q seconds’ 202107080833.13.286667115 202107080833.11 202107080833.12 202107080833.13 202107080833.14 202107080833.15
–// You can see that the middle time after sorting the file represents the time at which the command was executed. Note: There may be a small amount of error, assuming the execution is fast. –// If I’m using the Cygwin emulator on Windows and the execution is slow, I have this error.
$ seq -2 1 2 | xargs -IQ date “+%Y%m%d%H%M.%S” –date=’1 day ago Q seconds’ | xargs -IQ touch -t Q Q ; find . -name “2021” -mtime +0 -exec ls -ltr {} +; echo ====== ; ls -ltr ; Rm-f 2021-rw-r –r– 1 Oracle oinstall 0 Jul 7 08:36./202107070836.20
-rw-r–r– 1 Oracle oinstall 0 Jul 7 08:36./202107070836.21
Total 0 -rw-r–r– 1 Oracle oinstall 0 2021-07-07 08:36:20 202107070836.20-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:36:20 Oracle oinstall 0 2021-07-07 08:36:22 202107070836.22-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:36:22 202107070836.22-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:36:22 202107070836.22-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:36:23 202107070836.23-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:36:24 202107070836.24
–// The current execution time is 2021-07-08 08:36:22. –dawww.diuxie.comte=’1 day ago Q seconds’ –// find.-name “2021*” -mtime +0 –// I’m actually displaying files less than the current time of -1 day mobile game.
– / / at the back of the test shows no longer, you yourself look. $seq – 2 1 2 | xargs – IQ date “+ % Y m. H % m % d % % % S” – the date = ‘1 day line Q seconds’ | xargs – IQ touch – t Q Q ; find . -name “2021” -mtime 0 -exec ls -ltr {} +; echo ====== ; ls -ltr ; Rm-f 2021-rw-r –r– 1 Oracle oinstall 0 Jul 7 08:38./202107070838.24 — rw-r–r– 1 Oracle oinstall 0 Jul 7 08:38 . / 202107070838.25
-rw-r–r– 1 Oracle oinstall 0 Jul 7 08:38./202107070838.26
Total 0 -rw-r–r– 1 Oracle oinstall 0 2021-07-07 08:38:22 202107070838.22-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:38:22 Rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:38:24 202107070838.24-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:38:24 202107070838.24-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:38:25 202107070838.25-rw-r –r– 1 Oracle oinstall 0 2021-07-07 08:38:26 202107070838.26 –// Notice the date display –date=’1 day ago Q seconds’.
$ seq -2 1 2 | xargs -IQ date “+%Y%m%d%H%M.%S” –date=’0 day ago Q seconds’ | xargs -IQ touch -t Q Q ; find . -name “2021” -mtime 0 -exec ls -ltr {} +; echo ====== ; ls -ltr ; Rm-f 2021-rw-r –r– 1 Oracle oinstall 0 Jul 8 08:40./202107080840.42
-rw-r–r– 1 Oracle oinstall 0 Jul 8 08:40./202107080840.43
Total 0-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:42 202107080840.42-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:42 202107080840.42-rw-r –r– 1 Oracle oinstall 0 2021-07-08 Rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:44 202107080840.44-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:44 202107080840.44-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:44 202107080840.44-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:45 202107080840.45-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:40:46 202107080840.46 –// –date=’0 day ago Q seconds’. Type –date=’Q seconds’. Same thing.
$ seq -2 1 2 | xargs -IQ date “+%Y%m%d%H%M.%S” –date=’Q seconds’ | xargs -IQ touch -t Q Q ; find . -name “2021” -mtime -0 -exec ls -ltr {} +; echo ====== ; ls -ltr ; Rm-f 2021-rw-r –r– 1 Oracle oinstall 0 Jul 8 08:42./ 202107080842.23-rw-r –r– 1 Oracle oinstall 0 Jul 8 2021 . / 202107080842.24
-rw-r–r– 1 oracle oinstall 0 Jul 8 2021 ./202107080842.25
Total 0-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:42:21 202107080842.21-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:42:21 202107080842.21-rw-r –r– 1 Oracle oinstall 0 2021-07-08 -rw-r–r– 1 Oracle oinstall 0 20221-07-08 08:42:23 202107080842.23-rw-r –r– 1 Oracle oinstall 0 20221-07-08 08:42:23 202107080842.23-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:42:24 202107080842.24-rw-r –r– 1 Oracle oinstall 0 2021-07-08 08:42:25 202107080842.25