On Wed, 4 Jul 2001, Oliver Ob wrote:

> Richard Witt schrieb:
> > > I have just tgz'ed a new archive, say image.tgz.
> > >
> > > No problem with that, everything worked fine.
> > > But: How can I see the # of files inside the archive.
> > > tar -tvf does not give that number.
> > >
> >    Try:
> >
> >      tar -ztf image.tgz | wc
> >
> >    The first number you get back is the number of files in the tgz file
> > (note: this also includes the directories themselves).
> >
> >     HTH,
> >      Richard
> >
>
> thanks richard,
> but that is exactly the problem.
>
> I want # of files, not of both files and dirs.
>
> now, how can I get THAT done?

Just a simple addition to eliminate directories:

    tar -ztf image.tgz | grep -v '/$' | wc -l
                         ^^^^^^^^^^^^^^

Also adding "-l" gives just the "line" count or, in your case, the
number of files in the archive.

Jim

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to