[+] bash - pliki z okre

Potrzebujesz pomocy z C, C++, perl, python, itp.
sethiel
Junior Member
Posty: 762
Rejestracja: 28 stycznia 2008, 11:50
Lokalizacja: Wrocław

[+] bash - pliki z określonej daty

Post autor: sethiel »

Znalezienie plików starszych niż x dni i przeniesienie ich dalej:

Kod: Zaznacz cały

find ./ -type f -mtime +63 -print | xargs -I {} mv {} /tmp/2011-2012/
Ale jak zrobić to samo tylko inaczej.
Czyli nie pliki starsze niż +63 dni, tylko starsze niż 01.01.2013-00:00:01?
franek4always
Posty: 42
Rejestracja: 02 stycznia 2007, 21:25

Post autor: franek4always »

Skorzystaj z zanegowanej opcji -newerXY, a tak w ogóle to polecam man find

Kod: Zaznacz cały

       -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

              Some combinations are invalid; for example, it is invalid for X to be t.  Some combinations are not implemented on all systems; for example B is not supported on all systems.  If  an
              invalid  or  unsupported  combination of XY is specified, a fatal error results.  Time specifications are interpreted as for the argument to the -d option of GNU date.  If you try to
              use the birth time of a reference file, and the birth time cannot be determined, a fatal error message results.  If you specify a test which refers to the birth time of  files  being
              examined, this test will fail for any files where the birth time is unknown.
http://poradnik.telewizor.eu
Ostatnio zmieniony 25 maja 2016, 15:00 przez franek4always, łącznie zmieniany 1 raz.
sethiel
Junior Member
Posty: 762
Rejestracja: 28 stycznia 2008, 11:50
Lokalizacja: Wrocław

Post autor: sethiel »

Dzięki.
ODPOWIEDZ