[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Transfer group of directories through rsync
From: |
Kerin Millar |
Subject: |
Re: Transfer group of directories through rsync |
Date: |
Thu, 26 Aug 2021 09:29:18 +0100 |
On Thu, 26 Aug 2021 01:30:35 +0000
hancooper via <help-bash@gnu.org> wrote:
> I have a group of directories stored in a bash array called `group`.
>
> I want to use rsync to transfer the files to the same directory paths, but
> instead of ./01cuneus, the destination is ./temp
>
> I have a bash function that I use, called `myrsync` which takes the source
> and destination parent directories and the depth
> level (that's why ones sees three levels down `./01cuneus` in array `group`) .
>
> myrsync -j 3 --depth=3 --src=./01cuneus --dst=./temp
>
> group: ./01cuneus/tdr/margi/03d-chmed-mrgn
> ./01cuneus/freelic/latest/freelic-3.4 ./01cuneus/tdr/freelic/releases
> ./01cuneus/books/Infocs/cvs ./01cuneus/histr/gen-adm/behistun
> ./01cuneus/histr/gen-adm/uwdiving ./01cuneus/books/releases/survey
> ./01cuneus/books/GeoMtk/survey--for--geosc ./01cuneus/books/pictures/jpg
> ./01cuneus/books/Infocs/Gra ./01cuneus/tdr/ch-aggr/part2
> ./01cuneus/histr/gen-adm/tdr ./01cuneus/tdr/margi/01d-mimic-mrgn
> ./01cuneus/tdr/ideogr/06b-amcoh ./01cuneus/articles/detailed/infocs
> ./01cuneus/articles/detailed/advoc ./01cuneus/tdr/margi/04d-inadq-mrgn
> ./01cuneus/freelic/releases/freelic-1.0 ./01cuneus/tdr/margi/05d-wepst-mrgn
(
cd -- "$src" &&
rsync -aiR --from0 --files-from=<(printf '%s\0' "${group[@]#"$src/"}") . "$dst/"
)
--
Kerin Millar