Created
June 3, 2013 00:54
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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