#!/bin/bash
#
origem=$(pwd)
#
IFS=$(echo -en "\n\b")
#
echo $origem
#
for file in $(find -L $origem -type l,d -exec ls -d {} \;); do
    cd $file/
    tree -H . -L 1 --noreport --dirsfirst -T '#Arquivos no Servidor#' -C -F -h -s -D --charset utf-8 -I index.html -o index.html
    sed -i.bak 's/©/(c)/g' ./index.html
    sed -i.bak '/<p class="VERSION">/d' ./index.html
    sed -i.bak '/tree v2.2.1 (c) 1996 - 2024 by Steve Baker and Thomas Moore <br>/d' ./index.html
    sed -i.bak '/HTML output hacked and copyleft (c) 1998 by Francesc Rocher <br>/d' ./index.html
    sed -i.bak '/JSON output hacked and copyleft (c) 2014 by Florian Sesser <br>/d' ./index.html
    sed -i.bak '/(c) 2001 by Kyosuke Tokoro/d' ./index.html
    sed -i.bak '/<br><br>/d' ./index.html
    sed -i.bak 's|\../|\./|' ./index.html
    rm /y -f ./index.html.bak
done
