Léa-Linux & amis :   LinuxFR   GCU-Squad   GNU
script à l'aide
Envoyé par: mickou

Salut,

Je voudrais ecrire un script qui zip une liste de fichier, le nom de l'archive aura le nom toto_datedujour_heure.zip

Merci de votre aide

Poste le Wednesday 14 January 2004 21:06:01
Répondre     Citer    
Re: script à l'aide
Envoyé par: sanglier

#!/bin/sh
.....
for i in TALISTE; do zip OTPIONS $i_`date +"%d%m%y_%h%m"`.zip;done
.....
exit

---------[exemple]------------

linux:/home/stockage/2004 # ll
total 17412
drwxr-xr-x 2 root root 4096 Jan 15 05:57 .
drwxr-xr-x 40 kneko users 8192 Jan 13 18:59 ..
-rw-r--r-- 1 root root 4749958 Jan 9 23:16 ca%20part%20en%20couilles-leclic.wmv
-rw-r--r-- 1 root root 688884 Jan 9 23:17 casaute-02-01-04-leclic.wmv
-rw-r--r-- 1 root root 1473078 Jan 9 23:19 lepingle-02-01-04-le%20clic.wmv
-rw-r--r-- 1 root root 2702128 Jan 9 23:22 levirage-02-01-04-leclic.wmv
-rw-r--r-- 1 root root 8155384 Jan 9 23:30 run%20du%20nouvel%20ans%202004-02-01-04-leclic.wmv
linux:/home/stockage/2004 # for i in *; do tar cf {$i}_`date +"%d%m%y_%H%M"`.zip $i; done
linux:/home/stockage/2004 # ll
total 34856
drwxr-xr-x 2 root root 4096 Jan 15 05:57 .
drwxr-xr-x 40 kneko users 8192 Jan 13 18:59 ..
-rw-r--r-- 1 root root 4749958 Jan 9 23:16 ca%20part%20en%20couilles-leclic.wmv
-rw-r--r-- 1 root root 688884 Jan 9 23:17 casaute-02-01-04-leclic.wmv
-rw-r--r-- 1 root root 1473078 Jan 9 23:19 lepingle-02-01-04-le%20clic.wmv
-rw-r--r-- 1 root root 2702128 Jan 9 23:22 levirage-02-01-04-leclic.wmv
-rw-r--r-- 1 root root 8155384 Jan 9 23:30 run%20du%20nouvel%20ans%202004-02-01-04-leclic.wmv
-rw-r--r-- 1 root root 4761600 Jan 15 05:57 {ca%20part%20en%20couilles-leclic.wmv}_150104_0557.zip
-rw-r--r-- 1 root root 696320 Jan 15 05:57 {casaute-02-01-04-leclic.wmv}_150104_0557.zip
-rw-r--r-- 1 root root 1484800 Jan 15 05:57 {lepingle-02-01-04-le%20clic.wmv}_150104_0557.zip
-rw-r--r-- 1 root root 2713600 Jan 15 05:57 {levirage-02-01-04-leclic.wmv}_150104_0557.zip
-rw-r--r-- 1 root root 8161280 Jan 15 05:57 {run%20du%20nouvel%20ans%202004-02-01-04-leclic.wmv}_150104_0557.zip
linux:/home/stockage/2004 #cd ..
linux:/home/stockage# rm -rf 2004


ben la c'est la meme chose mais avec tar

Poste le Thursday 15 January 2004 05:55:18
Répondre     Citer    
Re: script à l'aide
Envoyé par: girof

j'aurai aime ecire un script (bash) qui calcule la differecnce entre deux dates

Poste le Thursday 22 January 2004 05:51:46
Répondre     Citer    

Veuillez vous authentifier auparavant pour commenter.

 

Ce forum !
script à l'aide
Pour poser vos questions sur les scripts shell, le Perl, le C, etc... Attention : nous ne sommes pas des spécialistes du dev, ce forum est juste pour de petites aides ponctuelles concernant le développement et les outils de développement.

Sauf mention contraire, les documentations publiées sont sous licence Creative-Commons