1832978 Members
2691 Online
110048 Solutions
New Discussion

Re: tar command

 
Kenn Chen
Advisor

tar command

How can i use tar command to tar the certain file , eg tar only 30 Oct 2000 created file.
Cyber Zen
5 REPLIES 5
Mr Anthony Wong
New Member

Re: tar command

It may be a foolish method, but you can try this:

# ls -l | grep "Oct 30" | awk '{print $NF}' | tar -cvf [Tape Drive]

Anthony Wong
Anthony
sung-hoon chang
Advisor

Re: tar command

Hello

You can try that...

sample))
# tar cvf - `ls -l | grep "Oct 30" | awk '{print $9}'` | dd of=/dev/rmt/0m bs=128k

"tar" can execute interprocess communication with only "dd".
federico_3
Honored Contributor

Re: tar command

you could use also:


ls -l | grep "Oct 30" | awk '{print $NF}' | cpio -o > /dev/rmt/cxtxdx ( tape device)


federico
Dan Hetzel
Honored Contributor

Re: tar command

Alternately, you can use a command like:

find / -mtime 10 | xargs tar cvf /dev/rmt/xxxx

which will tar all files on your system
having been modified in exactly 10 days.

Use atime for files being accessed..

The disadvantage is that you have to compute
the number of days but this can easily be
done by a shell or perl script, allowing
to replace the fixed figure by a variable.

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Ralph Grothe
Honored Contributor

Re: tar command

Only as an addition to Dan's reply,
if you already use Perl for the date conversion stuff I'd do the filesystem scour from within Perl as well, using Perl's standard File::Find module and define in two lines a callback sub reference.
Madness, thy name is system administration