#!/bin/bash
traverse()
{
# Traverse a directory
ls "$1" | while read i
do
if [ -d "$1/$i" ]; then
echo "Directory: $1/$i"
# Calling this as a subshell means that when the called
# function changes directory, it will not affect our
# current working directory
traverse "$1/$i"
else
echo "File: $1/$i" <=== HIER DIE BEARBEITUNG
fi
done
}
if [ -z "$1" ]; then
traverse .
else
traverse "$1"
fi