Live user <[email protected]> wrote:

> Either using
>
> tar -tf archive.tar
>
> OR
>
> tar --list -f archive.tar
>
> Doesn't show the trailing slash that corresponds to a dir, making 
> impossible to know if the content is a directory or a file without 
> having to use verbose output.
>
>
> Example: get the contents of a tar archive to a text file:
>
> tar --list -f myarchive.tar
> dir1
> dir1/data.dat
>
> Where it should be
>
> dir1/
> dir1/data.dat

No, whether or not a directory is listed with a traling slash depends on the 
file name in the archive. As the original tar (note that I am talking about tar 
and not gtar) from 1977 did not support directories, BSD coded them as files 
with a trailing slash.

POSIX.1-1988 then introduced a directory type flag and if this is used, the 
trailing slash is not needed.

If you like to distinct between directories and other files, I recommend to use 
star and it's build in find(1).

        star -t < filename -find -type d

lists only directories.

Jörg

-- 
 EMail:[email protected] (home) Jörg Schilling D-13353 Berlin
       [email protected]                (uni)  
       [email protected] (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

Reply via email to