#1 Le 06/09/2019, à 16:44
- Nihio
Recherche de fichiers plus récents qu'une date donnée
Salut
Dans mon cas j'aimerai copier tous les fichiers qui ont une extension particulière, récursivement, qui sont plus récents qu'une date donnée. Je peux le faire en précisant dans le find que je veux les fichiers plus récent que la date d'un fichier en particulier, mais j'aimerai que ça soit plus récent qu'une date donnée, et non une date de dernière modification d'un fichier.
Pour l'instant ma commande ressemble à ça :
find . \( -type d -name 'tmp' -prune \) -o \( -type f -name '*.eps' -newer '.profile' \) -exec cp {} tmp/ \;
Il cherche les fichiers plus récents que mon .profile, et il rassemble tout à la racine d'un répertoire tmp. Est-ce que je peux mettre une date à la place ? Il la lirait sous quel format ?
Merci
Dernière modification par Nihio (Le 06/09/2019, à 16:49)
Hors ligne
#2 Le 06/09/2019, à 17:02
- pingouinux
Re : Recherche de fichiers plus récents qu'une date donnée
Bonjour,
-newerXY reference
Succeeds if timestamp X of the file being considered is newer than time‐
stamp Y of the file reference. The letters X and Y can be any of the
following letters: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 timeSome 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.
Par exemple, pour trouver les fichiers modifiés après une certaine date :
find .... -newermt "2018-10-30 10:25:13" ....
Dernière modification par pingouinux (Le 06/09/2019, à 17:02)
Hors ligne
#3 Le 06/09/2019, à 17:11
- Nihio
Re : Recherche de fichiers plus récents qu'une date donnée
Parfait merci beaucoup, je teste ça lundi !
Hors ligne