Skip to content
WJunction - Webmaster Forum

Looking for: HTTP File Downloading script

Status
Not open for further replies.
Hi,

I am looking for a script that automatically downloads files with different filename (ranges). I am trying to download a great number of images with numbered. They are located in a directory see example:

Code:
http://www.website.com/images/2003000.jpg
http://www.website.com/images/2003001.jpg
http://www.website.com/images/2003002.jpg
http://www.website.com/images/2003003.jpg
http://www.website.com/images/2003004.jpg
and so on...

It should download filenames with a specific range, for example 2003000.jpg till 20030689.jpg

The script should run on a linux based system, thus a shell script, or PHP etc.

Thank you <3
 

4 comments

Ah wait, found this one:
Code:
[COLOR=#000000][FONT=Times New Roman][LEFT][FONT=Arial][COLOR=gray]#!/bin/bash[/COLOR][COLOR=#000000]
[/COLOR][COLOR=gray]# fixed vars[/COLOR][COLOR=#000000]
URL[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000]http[/COLOR][COLOR=#000000]://[/COLOR][COLOR=#000000]domain[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]com[/COLOR][COLOR=#000000]/[/COLOR][COLOR=#000000]logs[/COLOR][COLOR=#000000]/[/COLOR][COLOR=#000000]     [/COLOR][COLOR=gray]# URL address 'till logfile name[/COLOR][COLOR=#000000]
PREF[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000]logprefix                  [/COLOR][COLOR=gray]# logfile prefix (before number)[/COLOR][COLOR=#000000]
POSTF[/COLOR][COLOR=#000000]=.[/COLOR][COLOR=#000000]log                      [/COLOR][COLOR=gray]# logfile suffix (after number)[/COLOR][COLOR=#000000]
DIGITS[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#800000]3[/COLOR][COLOR=#000000]                        [/COLOR][COLOR=gray]# how many digits logfile's number have[/COLOR][COLOR=#000000]
DLDIR[/COLOR][COLOR=#000000]=~/[/COLOR][COLOR=#2B91AF]Downloads[/COLOR][COLOR=#000000]               [/COLOR][COLOR=gray]# download directory[/COLOR][COLOR=#000000]
TOUT[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#800000]5[/COLOR][COLOR=#000000]                          [/COLOR][COLOR=gray]# timeout for quit[/COLOR][COLOR=#000000]
[/COLOR][COLOR=gray]# code[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]for[/COLOR][COLOR=#000000](([/COLOR][COLOR=#000000]i[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#800000]1[/COLOR][COLOR=#000000];[/COLOR][COLOR=#000000]i[/COLOR][COLOR=#000000]<[/COLOR][COLOR=#800000]10[/COLOR][COLOR=#000000]**[/COLOR][COLOR=#000000]$DIGITS[/COLOR][COLOR=#000000];++[/COLOR][COLOR=#000000]i[/COLOR][COLOR=#000000]))[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]do[/COLOR][COLOR=#000000]
        file[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000]$PREF[/COLOR][COLOR=#800000]`printf "%0${DIGITS}d" $i`[/COLOR][COLOR=#000000]$POSTF   [/COLOR][COLOR=gray]# local file name[/COLOR][COLOR=#000000]
        dl[/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000]$URL$file                                 [/COLOR][COLOR=gray]# full URL to download    [/COLOR][COLOR=#000000]
        echo [/COLOR][COLOR=#800000]"$dl -> $DLDIR/$file"[/COLOR][COLOR=#000000]                   [/COLOR][COLOR=gray]# monitoring, can be commented[/COLOR][COLOR=#000000]
        wget [/COLOR][COLOR=#000000]-[/COLOR][COLOR=#000000]T $TOUT [/COLOR][COLOR=#000000]-[/COLOR][COLOR=#000000]q $dl [/COLOR][COLOR=#000000]-[/COLOR][COLOR=#000000]O $file
        [/COLOR][COLOR=#00008B]if[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000][[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]"$?"[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000]-[/COLOR][COLOR=#000000]ne [/COLOR][COLOR=#800000]0[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000]                            [/COLOR][COLOR=gray]# test if we finished[/COLOR][COLOR=#000000]
        [/COLOR][COLOR=#00008B]then[/COLOR][COLOR=#000000]
                exit
        [/COLOR][COLOR=#00008B]fi[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]done[/COLOR][/FONT][/LEFT][/FONT][/COLOR]

Testing it at this moment.
 
Status
Not open for further replies.

About the author

CuraHack
Banned · Joined
1,007
Messages
221
Reactions
63
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom