Recursive directory listings, including, tar, gzip, bzip2

Lee D. Rothstein lee at veritech.com
Mon Sep 8 14:22:57 EDT 2003


Thanks, Kevin, with a few mods it did almost
exactly what I wanted.

BTW, I'm actually running this on Cygwin. ;-)

Here's the finished script:
------------------------------------------------------------------
#!/usr/bin/bash

# rrls -- really recursive 'ls'

# original from Kevin D. Clark -- GNHLUG, 2003-09-08

if [ -z "$1" ] ; then
  dir1="."
else
  dir1=$1
fi

# Preserve the working original, in case of later screw-ups

#find $dir1 \
#  \( -name \*.tar.gz -print -exec sh -c 'gzip -dc {} | \
#    tar tf -' \; \) \
#  -o  \( -name \*.tar.bz2 -print -exec sh -c 'bzip2 -dc {} | \
#    tar tf -' \; \) \
#  -o \( -name \*.tar -print -exec tar tf {} \; \) \
#  -o \( -name \*.rpm -print -exec rpm -q -p {} -l \; \) \
#  -o \( -name \*.cpio -print -exec cpio -itI {} \; \) \
#  -o -print

find $dir1 \
  \( -name \*.tar.gz -print -exec sh -c 'gzip -dc {} | \
    tar -tv' \; \) \
  -o  \( -name \*.tar.bz2 -print -exec sh -c 'bzip2 -dc {} | \
    tar -tv' \; \) \
  -o \( -name \*.tar -print -exec tar -tv {} \; \) \
  -o \( -name \*.rpm -print -exec rpm -q -p {} -l \; \) \
  -o \( -name \*.cpio -print -exec cpio -itI {} \; \) \
  -o -exec ls -odAFhX {} \;





More information about the gnhlug-discuss mailing list