#! /bin/bash URL="https://www.mssl.ucl.ac.uk" wget -r \ -np \ -N \ -nH \ --cut-dirs=2 \ --no-check-certificate \ -I /missions/SolO/Webpages \ --http-user=SWAweb \ --http-password='cah05c:YN' \ $URL/missions/SolO/Webpages find . -name "*.[1-9]" | sort > to_delete find . -name "index.html*" | sort > to_delete_also for FILE in $(cat to_delete) do PREFIX=${FILE::-2} if [ -d "${PREFIX}" ] then echo "Suppression $FILE" rm -f $FILE fi done