Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

[Terminal] Comment créer un fichier avec la date du jour pour nom

4 réponses
Avatar
bpesenti_pala
Bonjour,

Ce serais pour nommer les sauvegarde d'une base mysql:
mysqldump -u user -h localhost -ppass base > base_date.sql
^^^^

4 réponses

Avatar
Patrick Stadelmann
In article <1hcsxd2.1rxvlj91xay0lrN%,
(Bruno) wrote:

Bonjour,

Ce serais pour nommer les sauvegarde d'une base mysql:
mysqldump -u user -h localhost -ppass base > base_date.sql
^^^^


Avec la commande "date", par exemple

... > base_`date "+%Y-%m-%d"`.sql

Voir le man pour la description du format.

Patrick
--
Patrick Stadelmann

Avatar
pere.noel
Bruno wrote:


Ce serais pour nommer les sauvegarde d'une base mysql:
mysqldump -u user -h localhost -ppass base > base_date.sql
^^^^


man date ?

par exemple :
date "+%Y%m%d%H%M"

qui donne :
date "+%Y%m%d%H%M"
200603261024

ou encore :
date "+%Y-%m-%d--%Hh%M"
2006-03-26--10h25


--
une bévue

Avatar
bpesenti_pala
Patrick Stadelmann wrote:

Avec la commande "date", par exemple

... > base_`date "+%Y-%m-%d"`.sql


Parfait.
Merci Patrick.

Avatar
bpesenti_pala
Une bévue wrote:

man date ?

par exemple :
date "+%Y%m%d%H%M"


Merci. Ca marche nickel.