#!/bin/bash
#
origem=$(pwd)
#
echo $origem
#
IFS=$(echo -en "\n\b")
#
#    tree -H xxx -L 1 --noreport --dirsfirst -T '#Arquivos no Servidor#' -C -F -h -s -D --charset utf-8 -I index.html -o index.html

for file in $(find $origem -type d -exec ls -d {} \;); do
    cd $file/
    tree -H xxx -L 1 --noreport --dirsfirst -T '#Arquivos no Servidor#' -C -F -h -s --charset utf-8 -I index.html -o index.html
    sed -i.bak 's/xxx//g' ./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
    rm /y -f ./index.html.bak
done
