Operating System - HP-UX
1752714 Members
5729 Online
108789 Solutions
New Discussion юеВ

Re: command to find and tar files

 
Sagar Sirdesai
Trusted Contributor

Re: command to find and tar files

Hi
find /dir -depth -name "back*" -type f -print | xargs tar -cvf back.tar


Thanks

Sagar
Dennis Handly
Acclaimed Contributor

Re: command to find and tar files

>Sagar: find /dir -depth -name "back*" -type f -print | xargs tar -cvf back.tar

As Duncan, Steven and I said, you can't use tar with find, unless you gnu tar or pax.

Your example will continually overwrite back.tar and not in a good way.
Laurent Menase
Honored Contributor

Re: command to find and tar files

are you looking for file starting with string back or file which filename start with back?

my solution was to backup files starting with back, not for which filename start with back.

else it is simply
find . -name back\* | xargs tar cvf mytar
Dennis Handly
Acclaimed Contributor

Re: command to find and tar files

>Laurent: find . -name back\* | xargs tar cvf mytar

How many times do we need to mention you can't use find and HP's tar this way? :-)