A voir également:
- Copier fichier caché linux
- Fichier rar - Guide
- Comment réduire la taille d'un fichier - Guide
- Comment ouvrir un fichier epub ? - Guide
- Ouvrir fichier .bin - Guide
- Fichier iso - Guide
6 réponses
huhu ca a l'air compliqué :)
Entretemps, j'ai trouvé la solution : cp n'utilise pas de RegExp mais des "expressions du shell" ... du coup "tout caractere sauf le point" s'écrit [!.] et non [^.] :)
fais exactement ce que je veux :)
Merci a tout le monde :)
Entretemps, j'ai trouvé la solution : cp n'utilise pas de RegExp mais des "expressions du shell" ... du coup "tout caractere sauf le point" s'écrit [!.] et non [^.] :)
cp -r monRep/.[!.]* repDest/
fais exactement ce que je veux :)
Merci a tout le monde :)
Essaie donc avec simplement un point, comme ça il copiera le répertoire ./ dans repDest... Or ./ existe déjà dans repDest c'est repDest lui-même.
Du coup ça marche !
cp -pR monRep/. repDest/
:-D
Du coup ça marche !
cp -pR monRep/. repDest/
:-D
Merci pour ta solution Atma !
lami20j
Messages postés
21331
Date d'inscription
jeudi 4 novembre 2004
Statut
Modérateur, Contributeur sécurité
Dernière intervention
30 octobre 2019
3 569
5 mai 2008 à 11:36
5 mai 2008 à 11:36
Salut,
pour l'info
si en 2005 [^.] ne fonctionnais pas, alors en 2008 il fonctionne ;-)
pour l'info
si en 2005 [^.] ne fonctionnais pas, alors en 2008 il fonctionne ;-)
root@debian:~/cache# ls -l total 0 -rw-r--r-- 1 root lami20j 0 2008-05-05 11:35 b -rw-r--r-- 1 root lami20j 0 2008-05-05 11:36 c root@debian:~/cache# ls -al total 1484 drwxr-xr-x 2 root lami20j 4096 2008-05-05 11:36 . drwxr-xr-x 25 root lami20j 1511424 2008-05-05 11:34 .. -rw-r--r-- 1 root lami20j 0 2008-05-05 11:34 .a -rw-r--r-- 1 root lami20j 0 2008-05-05 11:35 b -rw-r--r-- 1 root lami20j 0 2008-05-05 11:34 .b -rw-r--r-- 1 root lami20j 0 2008-05-05 11:36 c root@debian:~/cache# ls -al .[!.]* -rw-r--r-- 1 root lami20j 0 2008-05-05 11:34 .a -rw-r--r-- 1 root lami20j 0 2008-05-05 11:34 .b root@debian:~/cache# ls -al .[^.]* -rw-r--r-- 1 root lami20j 0 2008-05-05 11:34 .a -rw-r--r-- 1 root lami20j 0 2008-05-05 11:34 .b
ca ne m'intéresse de faire comme ça :)
je l'ai deja dit d'ailleurs ... "pas de "cp -pR monRep/ repDest/" " ;)
je veux copier les fichier/dossiers du répertoire et non le répertoire lui-même !
je l'ai deja dit d'ailleurs ... "pas de "cp -pR monRep/ repDest/" " ;)
je veux copier les fichier/dossiers du répertoire et non le répertoire lui-même !
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
jisisv
Messages postés
3645
Date d'inscription
dimanche 18 mars 2001
Statut
Modérateur
Dernière intervention
15 janvier 2017
934
5 nov. 2005 à 06:51
5 nov. 2005 à 06:51
Un petit coup de 'compound commands' et de tar sous bash:
johand@horus:~/tmp/testcache$ mkdir rep1 rep2 johand@horus:~/tmp/testcache$ ls -al rep1 rep2 rep1: total 8 drwxr-xr-x 2 johand johand 4096 2005-11-05 06:45 . drwxr-xr-x 4 johand johand 4096 2005-11-05 06:45 .. rep2: total 8 drwxr-xr-x 2 johand johand 4096 2005-11-05 06:45 . drwxr-xr-x 4 johand johand 4096 2005-11-05 06:45 .. johand@horus:~/tmp/testcache$ touch rep1/brol rep1/.h1 rep1/.h2 johand@horus:~/tmp/testcache$ (cd rep1 ; tar -c .)| (cd rep2 ;tar -x ) johand@horus:~/tmp/testcache$ ls -al rep2 total 8 drwxr-xr-x 2 johand johand 4096 2005-11-05 06:45 . drwxr-xr-x 4 johand johand 4096 2005-11-05 06:45 .. -rw-r--r-- 1 johand johand 0 2005-11-05 06:45 brol -rw-r--r-- 1 johand johand 0 2005-11-05 06:45 .h1 -rw-r--r-- 1 johand johand 0 2005-11-05 06:45 .h2
mamiemando
Messages postés
33574
Date d'inscription
jeudi 12 mai 2005
Statut
Modérateur
Dernière intervention
14 mars 2025
7 833
5 nov. 2005 à 00:37
5 nov. 2005 à 00:37
(~) $ mkdir test (~) $ cd test (~/test) $ touch .plop1 (~/test) $ touch .plop2 (~/test) $ touch plop3 (~/test) $ cd .. (~) $ cp -r test/ test2 (~) $ ls -al test2 total 8 drwxr-xr-x 2 mando users 4096 nov 5 00:35 . drwx------ 58 mando users 4096 nov 5 00:35 .. -rw-r--r-- 1 mando users 0 nov 5 00:35 .plop1 -rw-r--r-- 1 mando users 0 nov 5 00:35 .plop2 -rw-r--r-- 1 mando users 0 nov 5 00:35 plop3
Bonne chance