#!/bin/sh SOURCE="/u/sb/.www/download/bnp" TARGET="/u/sb/ftp" link_files () { source="$1" target="$2" ( cd "$target" for file in `/bin/ls -1 "$source"` do if [ -f "$source/$file" ] then if [ "x$file" = "xREADME" ] then ln "$source/$file" "$file.txt" else ln "$source/$file" "$file" fi fi done ) } cd "$TARGET" if [ $? -ne 0 ] then exit 1 fi rm -rf * cd "$SOURCE" for dir in `find . -type d -print | sed -e 's|^\./||' | sort` do if [ "x$dir" = "x." ] then link_files "$SOURCE" "$TARGET" else mkdir "$TARGET/$dir" link_files "$SOURCE/$dir" "$TARGET/$dir" fi done