Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Help on a script...



On Sun, Jun 3, 2012 at 4:30 PM, Bruno Raoult <braoult@example.com> wrote:
> Hi all! And happy Mother's day if it the same than in France...
>
> I have a question for you: Do you know how to copy (rsync via ssh) a tree
> only, no files? I just want to avoid long log file, with directories...
>
Is this what you need:
$ cd /tmp
$ mkdir -p d1/D{2,3,4,5,6} d1/G{3,4}/F5
$ touch d1/D{2,3,4,5,6}/some_file d1/G{3,4}/F5/other d1/
$ touch d1/D{2,3,4,5,6}/some_file d1/G{3,4}/F5/other d1/D{2,3,4,5,6}/evenMORE
$ LC_ALL=C tree d1/
d1/
|-- D2
|   |-- evenMORE
|   `-- some_file
|-- D3
|   |-- evenMORE
|   `-- some_file
|-- D4
|   |-- evenMORE
|   `-- some_file
|-- D5
|   |-- evenMORE
|   `-- some_file
|-- D6
|   |-- evenMORE
|   `-- some_file
|-- G3
|   `-- F5
|       `-- other
`-- G4
    `-- F5
        `-- other
$ rsync -HavPS /tmp/d1/ /tmp/d2/ --include=*/ --exclude=*
sending incremental file list
created directory /tmp/d2
./
D2/
D3/
D4/
D5/
D6/
G3/
G3/F5/
G4/
G4/F5/

sent 187 bytes  received 51 bytes  476.00 bytes/sec
total size is 0  speedup is 0.00
$ LC_ALL=C tree d2
d2
|-- D2
|-- D3
|-- D4
|-- D5
|-- D6
|-- G3
|   `-- F5
`-- G4
    `-- F5

NB: order of include/exclude is important.
NB2: "-HavPS" may not be the best of options, I used it every time and
don't bother remembering what it means; works here

Cheers,
Kalin.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links