[Trilug-ontopic] [bash] copying `find`ed files across network

Tom Roche Tom_Roche at pobox.com
Wed May 23 21:09:46 EDT 2012


ttp://www.trilug.org/pipermail/trilug-ontopic/2012-May/000317.html
Tom Roche Wed, 23 May 2012 17:19:04 -0400
>>> # case 1: `raw find`
>>> * $ ssh t "pushd /work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc ; find . -type f | grep -ve 'CCTM\|CVS\|~$\|\.o$' | wc -l"
>>> * /work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc ~
>>> * 266

>>> # case 2: `find` inside `tar`
>>> * $ ssh t "pushd /work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc ; tar cfvz - $(find . -type f | grep -ve 'CCTM\|CVS\|~$\|\.o$')" | tar xvfz -
>>> * tar: Cowardly refusing to create an empty archive

http://www.trilug.org/pipermail/trilug-ontopic/2012-May/000320.html
Thomas Gardner Wed, 23 May 2012 19:23:09 -0400
>> I think [the case 2 `find`] is actually running on your local
>> machine before the ssh process ever starts.

Worth checking:

me at local:~$ ssh t
...
me at remote:~ $ pushd /work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc
me at remote:/work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc $ find . -type f | grep -ve 'CCTM\|CVS\|~$\|\.o$' | wc -l
> 266
me at remote:/work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc $ tar cfvz - $(find . -type f | grep -ve 'CCTM\|CVS\|~$\|\.o$') > /tmp/tar.gz
> ./CONST.EXT
...
> ./s_emis_defn.mod
me at remote:/work/MOD3EVAL/nsu/boundary/BLD_ddm_saprc07tc $ tar tfz /tmp/tar.gz | wc -l
> 266

So it appears the problem is not with the `find`, or with `tar` args,
but with `ssh` or the network pipe ... or am I missing something?

Will try again, once I'm back on the network. Unfortunately, mgmt
doesn't currently allow students remote access :-(


More information about the Trilug-ontopic mailing list