Script copie fichier

kamax -  
lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention   -
Bonjour,
je souhaite faire un script qui me permette de copier tous les fichiers d'un répertoire X dans un autre répertoire temporaire. Puis de rendre tous les fichiers et répertoires read-only. Ensuite, de les zipper.
Quelqu'un peut-il m'aider?
Configuration: Windows XP
Firefox 2.0.0.6

1 réponse

  1. lami20j Messages postés 21506 Date d'inscription   Statut Modérateur, Contributeur sécurité Dernière intervention   3 571
     
    Salut,
    root@debian:~# ls -lR X/
    X/:
    total 8
    -rw-r--r-- 1 root lami20j    0 2007-09-13 15:46 a
    -rw-r--r-- 1 root lami20j    0 2007-09-13 15:46 b
    -rw-r--r-- 1 root lami20j    0 2007-09-13 15:46 c
    drwxr-xr-x 2 root lami20j 4096 2007-09-13 15:47 rep1
    drwxr-xr-x 2 root lami20j 4096 2007-09-13 15:48 rep2
    
    X/rep1:
    total 0
    -rw-r--r-- 1 root lami20j 0 2007-09-13 15:47 aa
    -rw-r--r-- 1 root lami20j 0 2007-09-13 15:47 bbb
    
    X/rep2:
    total 0
    -rw-r--r-- 1 root lami20j 0 2007-09-13 15:48 ccc
    root@debian:~# ls -l TEMP/
    total 0
    root@debian:~# cp -R X/* TEMP/
    root@debian:~# ls -lR TEMP/
    TEMP/:
    total 8
    -rw-r--r-- 1 root lami20j    0 2007-09-13 15:49 a
    -rw-r--r-- 1 root lami20j    0 2007-09-13 15:49 b
    -rw-r--r-- 1 root lami20j    0 2007-09-13 15:49 c
    drwxr-xr-x 2 root lami20j 4096 2007-09-13 15:49 rep1
    drwxr-xr-x 2 root lami20j 4096 2007-09-13 15:49 rep2
    
    TEMP/rep1:
    total 0
    -rw-r--r-- 1 root lami20j 0 2007-09-13 15:49 aa
    -rw-r--r-- 1 root lami20j 0 2007-09-13 15:49 bbb
    
    TEMP/rep2:
    total 0
    -rw-r--r-- 1 root lami20j 0 2007-09-13 15:49 ccc
    root@debian:~# chmod -R 0444 TEMP/
    root@debian:~# ls -ld TEMP/
    dr--r--r-- 4 root lami20j 4096 2007-09-13 15:49 TEMP/
    root@debian:~# ls -lR TEMP/
    TEMP/:
    total 8
    -r--r--r-- 1 root lami20j    0 2007-09-13 15:49 a
    -r--r--r-- 1 root lami20j    0 2007-09-13 15:49 b
    -r--r--r-- 1 root lami20j    0 2007-09-13 15:49 c
    dr--r--r-- 2 root lami20j 4096 2007-09-13 15:49 rep1
    dr--r--r-- 2 root lami20j 4096 2007-09-13 15:49 rep2
    
    TEMP/rep1:
    total 0
    -r--r--r-- 1 root lami20j 0 2007-09-13 15:49 aa
    -r--r--r-- 1 root lami20j 0 2007-09-13 15:49 bbb
    
    TEMP/rep2:
    total 0
    -r--r--r-- 1 root lami20j 0 2007-09-13 15:49 ccc
    root@debian:~# zip -r temp.zip TEMP/  
      adding: TEMP/ (stored 0%)
      adding: TEMP/b (stored 0%)
      adding: TEMP/c (stored 0%)
      adding: TEMP/rep2/ (stored 0%)
      adding: TEMP/rep2/ccc (stored 0%)
      adding: TEMP/rep1/ (stored 0%)
      adding: TEMP/rep1/aa (stored 0%)
      adding: TEMP/rep1/bbb (stored 0%)
      adding: TEMP/a (stored 0%)
    root@debian:~# ls -l temp.zip
    -rw-r--r-- 1 root lami20j 1174 2007-09-13 15:51 temp.zip
    root@debian:~#
    
    
    En gras tu as les commandes
    0