View previous topic :: View next topic |
Author |
Message |
slick Bodhisattva
![Bodhisattva Bodhisattva](/images/ranks/rank-bodhisattva.gif)
![](images/avatars/155298905545589d9986ab5.gif)
Joined: 20 Apr 2003 Posts: 3495
|
Posted: Fri Jul 04, 2003 4:28 pm Post subject: Dateien kopieren, aber nur wenn ziel vorhanden |
|
|
Ich würde gern eine Verzeichnisstruktur, sagen wir mal /A nach /B, rekursiv(!) kopieren. Dabei möchte ich aber nur die Dateien kopieren die es in B schon gibt. Ich weis es gibt bei cp die option --update, aber in meinem Falls kann es durchaus sein dass die Quelldatei älter ist als die Zieldatei und dennoch kopiert werden soll.
Ihr wißt doch bestimmt ne Lösung... ![Smile :-)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
compu-tom Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 09 Jan 2003 Posts: 415 Location: Berlin, Germany
|
Posted: Fri Jul 04, 2003 7:21 pm Post subject: |
|
|
Vielleicht hilft ja rsync mit der Option --existing? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Kampi n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 05 Apr 2003 Posts: 20 Location: Vienna, Austria, Europe
|
Posted: Fri Jul 04, 2003 7:34 pm Post subject: |
|
|
hab das nicht getestet, aber ich würds so probieren:
Code: |
find /B -name "*" -exec cp /A/{} /B \;
|
find listet bei mir so nur dateien und keine dirs, aber wenn ich dein problem richtig verstanden hab, dann ist das eh genau das, was du brauchst... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
SuperGrobie n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/4451527533eff5f0760538.gif)
Joined: 24 May 2003 Posts: 11 Location: Dresden/Germany
|
Posted: Fri Jul 04, 2003 7:40 pm Post subject: |
|
|
Code: |
cd $dirA
find . > /tmp/.list
cd $dirB
cp `cat /tmp/.list` $dirA
|
Würde ich vorschlagen. _________________ "I'm sorry, I can't hear you - there's a banana in my ear!" |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|