moving multiple files --recursively using BSD

i am using a FreeBSD remote account and I have directory that holds a number of
other directories most of which posses *.tgz *.tar.bz2 *.gz files... on a linux system
i would use a find format such as this to locate and mv *.tgz and .tar.bz2 files
find ./dir -type f -iname "*.t[argz]
[bz2]" -print | xargs mv --target-directory=dir

on bsd this doesn't work since the mv options are slightly differenr than gnu linux..

i used "find ./dir -depth -print | cpio -ov > tree.cpio" and mv the file to a said dir and
extracted the filesystem but i could not find a way to extract just the files using find,
xargs or cpio on the BSD system... what I had to do was ftp the file to my linux system
do all operations and scp the whole directory of extracted files back to the account..
how would i go about extracting just the files using find and xargs or cpio on BSD
without having to go through the rigmarole of ftping back forth between my linux
system and the remote account...
thanx moxxx68 :slight_smile:

excuse the grievance: i have a small typo that would make difference to anyone looking at
my post;;
find ./dir -type f -iname "*.t[arg]*[bz]2" -depth -print0 | cpio --null -pvd ./target-dir
without the print0 expression you might get a slightly different result.. unfortunately on some
bsd systems i am pretty sure that it doesn't exist ... i could be wrong though.. :rolleyes:

Not using FreeBSD , :frowning: but if the following find command can display the files you want to move .
find ./dir -type f -iname "*.t[argz][bz2]" -print
then you might try this
#find ./dir -type f -iname "*.t[argz]
[bz2]" -print > /tmp/file.list
#tar cvf - `cat /tmp/file.list` | ( cd /target_dir;tar xvf - )
now you just have to remove the old files .

thanx for the replay will try!
moxxx68 :wink:

this worked to a certain extent but this command does the same thing although it is not quite what
i am looking for..
find . ./dir -type f -iname "*.t[argz]*[bz]2" -depth -print | cpio --null -pvd ./target-directory
this will do exactly what you did using tar... but still doesn't extract the files only.. my main
concern in the filesystem that I am using is speed since it is a large filesystem and has many
changes applied daily to the files.. using the above methods means i must go in and individually
extract each file one by one.. i think due to my using linux's "xargs mv --target-directory=./"
option using find all the time I may have over looked a few options that are basically simple
or too obvious .. . just for clarification i understand that only the selected files are transfrered
to the desired directory but they are still archived in their original directories since the all
the directories are transfered too empty or not.. what I need is to transfer just the files through
an extraction method to one said directory.. .
thanx moxxx68 :rolleyes: