1753859 Members
7423 Online
108809 Solutions
New Discussion юеВ

find and cpio,tar

 
SOLVED
Go to solution
Michael_33
Regular Advisor

find and cpio,tar

Hi all,

I want to find all the .log file under /home,and save all of them to a file(not tape),how should I do?

Thanks!
3 REPLIES 3
Justo Exposito
Esteemed Contributor
Solution

Re: find and cpio,tar

Hi Michael,

Someting like that:

Find /home -name "*.log" | tar cvf fichname

Regards,

Justo.
Help is a Beatiful word
Kenneth_19
Trusted Contributor

Re: find and cpio,tar

You can try:

tar -cvf output.tar `find /home -name \*.log`

Regards,
Kenneth
Always take care of your dearest before it is too late
Stefan Farrelly
Honored Contributor

Re: find and cpio,tar


1. first create your tar file by tar'ing a single file to it; tar cvf /tmp/
2.
for i in $(find /home -name "*.log" -print)
do
tar rvf /tmp/ $i
done

This will append all the log files in /home to the tar file you created in 1.
Im from Palmerston North, New Zealand, but somehow ended up in London...