help-bash
[Top][All Lists]
Advanced

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

Re: Transfer group of directories through rsync


From: Andreas Kusalananda Kähäri
Subject: Re: Transfer group of directories through rsync
Date: Fri, 27 Aug 2021 01:48:04 +0200

On Thu, Aug 26, 2021 at 11:37:10PM +0000, hancooper wrote:
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> On Thursday, August 26th, 2021 at 9:58 PM, Kerin Millar <kfm@plushkava.net> 
> wrote:
> 
> > On Thu, 26 Aug 2021 09:33:11 +0000
> >
> > hancooper hancooper@protonmail.com wrote:
> >
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > >
> > > On Thursday, August 26, 2021 8:29 AM, Kerin Millar kfm@plushkava.net 
> > > wrote:
> > >
> > > > 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
> > >
> > > Thank you so very much Kerin. Am wondering what the enclosing parentheses 
> > > are about.
> >
> > With the parentheses, it constitutes a compound command that is executed in 
> > a subshell. Changing the current working directory will thus not affect the 
> > execution environment of the parent shell.
> >
> > Kerin Millar
> 
> What is behind the `-i, --itemize-changes` option?
> Info says "output a change-summary for all updates".

Honestly, read a bit further down in the manual.  The section on
--itemize-changes is quite long and detailed.  Also, as far as I know,
rsync is an external command not specifically related to the bash shell.


-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]