#!/bin/bash DIR=$1 # Define sufixes for directory names, that shouldn't be moved to the server: declare -a exclude_dirs exclude_dirs=('RCS' 'CVS' '.git' '_MTN' '.hg') # define suffixes for files, that should not be moved to the server: declare -a exclude_files exclude_files=('.jpg' '.png' '.gif') # This checks wether we have to run for this directory function exclude_directory () { for suf in ${exclude_dirs[@]} ; do is_excluded=${1%$suf} if [ "$is_excluded" != "$1" ] ; then return 0 fi done return 1 } # This checks wether we have to run for this file function exclude_file () { for suf in ${exclude_files[@]} do is_excluded=${1%$suf} if [ "$is_excluded" != "$1" ] ; then return 0 fi done return 1 } function toOrgRec { local BUFFER="" for d in $( echo "$(find $1 -maxdepth 1 -type d )" | tail -n +2 ); do if ! exclude_directory "$d"; then BUFFER="${BUFFER} * [[file:${d}][$(basename ${d})]]" toOrgRec ${d} BUFFER=${BUFFER}$( echo "${RETURN_BUFFER}" | sed "s/^\*/**/" | sed "s/^ / /" ) fi done for f in $(find $1 -maxdepth 1 -not -type d); do if ! exclude_file "${f}"; then BUFFER="${BUFFER} * [[file:${f}][$(basename "${f}" )]]" fi done RETURN_BUFFER=${BUFFER} } toOrgRec ${DIR} echo "$( echo "${RETURN_BUFFER}" | tail -n +2 )" -- Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover Tel.: +49 (0)511 - 36 58 472 Fax: +49 (0)1805 - 233633 - 11044 mobil: +49 (0)173 - 83 93 417 Http: www.emma-stil.de