Skip to content

Instantly share code, notes, and snippets.

@crazy-max
Created June 3, 2013 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crazy-max/5695570 to your computer and use it in GitHub Desktop.
Save crazy-max/5695570 to your computer and use it in GitHub Desktop.
wget file list recursively see url decode gist to decode files found : https://gist.github.com/crazy-max/5695521
#! /bin/sh
function wgetFind() {
local host="$1"
local path="$2"
local files=$(wget -q -O - "$host$path" | grep -o 'ftp:[^"]*')
while read -r line
do
local file=$(echo "$line" | sed "s#&\#32;#%20#g" | sed "s#$host# #g" | cut -c2-)
if [ "${file#${file%?}}" == "/" ]
then
wgetFind "$host" "$file"
else
echo "$file"
fi
done <<< "$files"
}
FOUND=$(wgetFind "http://www.foo.com" "/public/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment