473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Writing a batch file to download many .pdf files...

I am attempting to quickly download nearly 1000 .pdf files from a website. Each .pdf has a unique url, and they run in sequence from 1-1000.

I would like help writing a batch file that I could run once and would (in the background) access the .pdf via its url, save a copy, and then move on to the next one.

Similar to (this is sloppy C++ and English combined, its been a while since i've used the language and I do not know Batch files at all):

Expand|Select|Wrap|Line Numbers
  1. int a = 1;
  2. string URL;
  3. for(int i=1; i<1000; i++,a++) {
  4.     URL = "http://www.site.com/file"+a+".pdf"
  5.     open page in background URL;
  6.     save file using existing webpage title name;
  7. }
  8.  
If it is easier, I also have a text file that includes a list of all the URLs in sequence, so if accessing that file to acquire the text of the URL would be easier, please help me with that instead.

Thanks,
John
Feb 14 '11 #1
1 3470
Guido Geurs
767 Expert 512MB
This is how it's done in VB6.
It's also possible to load the textfile with URL's in a list and run trough the list to load and save them.
This example loads the logo of Bytes, saves it on the C:\ and displays it in a picturebox.

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function URLDownloadToFile Lib "urlmon" _
  2.     Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
  3.     ByVal szURL As String, ByVal szFileName As String, _
  4.     ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
  5.  
  6. Private Sub Form_Load()
  7.     ' Download the file.
  8.     URLDownloadToFile 0, _
  9.         "http://bytes.com/images/logo4.gif", _
  10.         "C:\logo4.gif", 0, 0
  11.  
  12.     ' Display the image.
  13.     picBanner.Picture = _
  14.         LoadPicture("C:\logo4.gif")
  15.  
  16.     ' Size to fit.
  17.     Me.Width = picBanner.Width + 2 * picBanner.Left + _
  18.         (Me.Width - Me.ScaleWidth)
  19.     Me.Height = picBanner.Height + 2 * picBanner.Left + _
  20.         (Me.Height - Me.ScaleHeight)
  21. End Sub
Feb 15 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: rox.scott | last post by:
Security issues, warning messages, etc., aside, what MIME-type combination do I need for and ASP to write a BAT file to the response stream? e.g. Response.Clear Response.ContentType =...
0
by: SkySea | last post by:
Hi! Any help on this would be appreciated... In an HTML document that lists instructions on installing some software, there's a point where a DOS batch file needs to be run in order to copy...
1
by: GRE | last post by:
I'm hoping someone can help with this problem; I've seen only a handful of postings related to it, but with no clear resolution. I have an ASP.NET 1.1 page that downloads requested files via the...
3
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see...
4
by: | last post by:
Hello, I am attempting to convert multiple .wav files to the .flac format via a batch script. I know that this can be done with numerous software implementations automatically for me; however, i am...
5
by: benyod79 | last post by:
I'm hoping someone will be able to assist with this one. Using a scheduling program I'd like to run a batch file that runs a macro to creat e a copy of the opened database. Then, using batch again,...
3
by: hughie | last post by:
Has anyone done this? A windows webserver has a share on the same computer that contains some dos batch files. I'm trying to write a php page that will execute them. After much thrashing around...
1
by: deepikabg | last post by:
Hi, Im v.new to postgres. I needed some help writing batch files. I wanted to run psql commands in a batch file. I give 2 inputs to the batch file -- Username and Database name I want my batch...
0
hsn
by: hsn | last post by:
hello everyone. i am writing a batch file which runs some commands and then run another cmd. so there is two cmds, the main one which runs the 2nd one. in the batch file i can exit from the 1st cmd...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.