in reply to listing files in tar archive, with depth 1

Getting a list of all files seems fine to me. Either way, you'd have to read all of the tar archive to find all the deep 1 filenames.

You could use tar -t --exclude="*/*" from command-line to get only the depth one names, at least if you have GNU tar – but note that there need not be any such filename: the archive can contain files under some directory but not the directory itself.

Update: if you're planning to extract the archive, it might be easier to extract it to a subdirectory first, then look at what files got created in that subdirectory, then move them to their final location.

Replies are listed 'Best First'.
Re^2: listing files in tar archive, with depth 1
by loituma (Initiate) on Jun 23, 2011 at 19:49 UTC

    Ok, I thought I could do something faster, because I know the name of the file I am interested in (I just need the name of the dir). but if not, I'll keep the way I was doing, thxs.

    and thxs for the update advice; I donno yet, but it might be usefull for later