Script sous unix
jamy
-
jisisv -
jisisv -
bonjour,
je suis débutant en unix, et je dois réaliser un script. le but du script est de pouvoir trier les fichiers contenus dans un répertoire d'un utilisateur quelconque, selon l'extension du fichier. ces fichiers seront classés dans des répertoires ayant comme nom l'extension des fichiers.
je ne sais pas du tout comment faire. j'ai besoin d'un gros coup de pouce.
merci infiniment.
jamy
je suis débutant en unix, et je dois réaliser un script. le but du script est de pouvoir trier les fichiers contenus dans un répertoire d'un utilisateur quelconque, selon l'extension du fichier. ces fichiers seront classés dans des répertoires ayant comme nom l'extension des fichiers.
je ne sais pas du tout comment faire. j'ai besoin d'un gros coup de pouce.
merci infiniment.
jamy
A voir également:
- Script sous unix
- Script vidéo youtube - Guide
- Ghost script - Télécharger - Polices de caractères
- Mas script - Accueil - Windows
- Script cmd - Guide
- Fichier executable unix ✓ - Forum MacOS
2 réponses
Un truc basique qui me vient à l'esprit, à toi à améliorer, beautifier...
Johan
Gates gave you the windows.
GNU gave us the whole house.(Alexandrin)
johand@horus:~/tmp$ ls
boutique-full-pgsql.dump fond-existant.jpg fond-pres-debian.jpg
fond-apt.jpg fond-installation.jpg fond-src-info.jpg
fond-config-base.jpg fond-plus-loin.jpg index.html
fond-etude-cas.jpg fond-pouce.jpg virtualdub
johand@horus:~/tmp$ export dest=/tmp/inutile ;mkdir $dest; for file in $(find . -type f -maxdepth 1 ); do extension=${file##*.}; test -d $dest/$extension || mkdir $dest/$extension ;cp $file $dest/$extension; done
johand@horus:~/tmp$ ls -lR /tmp/inutile/
/tmp/inutile/:
total 12
drwxr-xr-x 2 johand johand 4096 Dec 2 18:56 dump
drwxr-xr-x 2 johand johand 4096 Dec 2 18:56 html
drwxr-xr-x 2 johand johand 4096 Dec 2 18:56 jpg
/tmp/inutile/dump:
total 16
-rw-r----- 1 johand johand 14173 Dec 2 18:56 boutique-full-pgsql.dump
/tmp/inutile/html:
total 4
-rw-r--r-- 1 johand johand 30 Dec 2 18:56 index.html
/tmp/inutile/jpg:
total 1528
-rw-r--r-- 1 johand johand 73148 Dec 2 18:56 fond-apt.jpg
-rw-r--r-- 1 johand johand 149076 Dec 2 18:56 fond-config-base.jpg
-rw-r--r-- 1 johand johand 234298 Dec 2 18:56 fond-etude-cas.jpg
-rw-r--r-- 1 johand johand 138285 Dec 2 18:56 fond-existant.jpg
-rw-r--r-- 1 johand johand 146148 Dec 2 18:56 fond-installation.jpg
-rw-r--r-- 1 johand johand 160071 Dec 2 18:56 fond-plus-loin.jpg
-rw-r--r-- 1 johand johand 116018 Dec 2 18:56 fond-pouce.jpg
-rw-r--r-- 1 johand johand 281080 Dec 2 18:56 fond-pres-debian.jpg
-rw-r--r-- 1 johand johand 211141 Dec 2 18:56 fond-src-info.jpg
Johan
Gates gave you the windows.
GNU gave us the whole house.(Alexandrin)