[CLUG-tech] recursive tar

Jan Groenewald jan at aims.ac.za
Thu Mar 8 09:27:16 SAST 2007


Hi

On Thu, Mar 08, 2007 at 09:16:22AM +0200, Zoltan Szecsei wrote:
> What would be the most compact way to recursively pick out and tar up 
> files with a specific extension?
> eg:
> #! /bin/sh
> TAR="/bin/tar"
> # runs daily backups for project
> cd /mnt/gw0_U/Data_Capturing
> $TAR cfz /home/data/tarzGW0_`date +%Y%m%d` */*.prj
> So, I have a top-level directory within which are deeper directories 
> (possibly with deeper directories) and I want to back up all *.prj 
> files, keeping their directory names relative to my top-level directory. 
> The top-level directory does not have any .prj files
> tar with --recursive (supposed default) does not help.

Uhm, I think your extension disables recursion.
tar cvf tarzGW0_`date +%Y%m%d`.tar `find . -iname '*.prj'`

cheers,
Jan
-- 
   .~.
   /V\     Jan Groenewald
  /( )\    www.aims.ac.za
  ^^-^^


More information about the clug-tech mailing list