#! /bin/bash # put listing of files in current dir into a html-file # author: Joerg arndt (arndt (AT) jjj.de) # version: 2011-April-25 (18:16) #set -v XCLNAME='' while getopts :x: OPT; do case $OPT in x|+x) XCLNAME=$OPTARG ;;*) echo "usage: ${0##*/} [+-x ARG} [--] ARGS..." exit 2 esac done shift $[ OPTIND - 1 ] cat < EOF echo '' SEDEX='s/^[^ ]+ [^ ]+ //;' echo '

files, alphabetically:

' echo '
'
#set -vx
ff=$(ls -1);
for f in $ff ; do
    if [ $f = "$XCLNAME" ]; then  continue; fi;
    if [ -f $f -o -d $f ]; then
        if [ -h $f ]; then  continue; fi;  ## skip symbolic links
#        s=$(ls -dl -G -h --full-time $f);
#        s=$(ls -dl -G -h --time-style=long-iso $f);
        s=$(ls -dg -G -h --time-style=long-iso $f | sed -r "$SEDEX");
        test -d $f  &&  { s=$s'/'; f=$f'/'; }
        echo "$s";
    fi;
done
echo '
' echo '

' echo '

files, time ordered (newest near top):

' echo '
'
#set -vx
ff=$(ls -1t);
for f in $ff ; do
    if [ $f = "$XCLNAME" ]; then  continue; fi;
    if [ -f $f -o -d $f ]; then
        if [ -L $f ]; then  continue; fi;  ## skip symbolic links
#        s=$(ls -dl -G -h --full-time $f);
#        s=$(ls -d -g -G -h --time-style=long-iso $f);
        s=$(ls -d -g -G -h --time-style=long-iso $f | sed -r "$SEDEX");
        test -d $f  &&  { s=$s'/'; f=$f'/'; }
        echo "$s";
    fi;
done
echo '
' cat < EOF exit 0; ###################################