LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using WGET to download specific filetype (https://www.linuxquestions.org/questions/linux-newbie-8/using-wget-to-download-specific-filetype-525058/)

itz2000 02-02-2007 02:45 PM

Using WGET to download specific filetype
 
Hello...nvm

gilead 02-02-2007 03:32 PM

Have a look at man wget for the -A option. There are examples using -A.gif and -A "*.gif" that do pretty much what you're asking for...

tsunami_imcool 02-02-2007 07:27 PM

have you tried
wget http://www.somesite/folder/*.pdf
with the wild-card in there? thats what i'd try

itz2000 02-03-2007 04:49 AM

Thanks
 
Thanks, Actually... written a script that does that, here it is in case you want to use it one day :

Code:

#!/bin/bash


function usage()
{
        echo $0 " delimiter website_adress filetype";
echo "      delimiter - (number, 6 is good for default apache, try less for iis)";
echo "      filetype - e.g pdf, zip ";
echo " ";
echo "    Example usage : "$0" 6 http://www.ebooks.com/insiderfolder pdf";
}
if [ $# -ne 3 ]; then
        usage;
        exit 1;
else
        echo "var is okay";
fi

delimiter=$1;
default=index.html;
website=$2;
filetype=$3;
folder=tmp;
mkdir $folder && cd $folder;

wget $website;#`echo /$default`;
cat $default | sed 's@.*href="(.*)".*@1@g' | cut -d '"' -f $delimiter | grep $filetype > tmplist;
for file in $(cat tmplist); do
        wget $website`echo /$file`;
        mv $file ../;
done



All times are GMT -5. The time now is 12:07 AM.