473,804 Members | 3,196 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 3530
Guido Geurs
767 Recognized Expert Contributor
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
1405
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 = "application/octet-stream" Response.AddHeader "Content-Disposition", "attachment;filename=message.bat" Response.Write("net send COMPUTER2 success") Response.End() This code does not work! Which is surprising because in my current config, the following html...
0
10157
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 files from the CD to the hard drive. Given that CD drives can have various names, I wanted to run the batch file using relative paths. The problem is, the DOS window that opens to run the batch file can leave the command prompt at any location . So...
1
2269
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 "Response.BinaryWrite(...)" method. The problem is that the page is dynamically built, and after the download completes all javascript functions suddenly break or exhibit unpredictable behavior. I've traced the issue down the use of the...
3
4477
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 cmd.exe with ASPNET as a user. But nothing happens. It can't execute the batch file. This is the code i am using to run the batch file:
4
2664
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 interested to understand how to create a script to perform my purpose and since this function is useful, what the hey! I am rather new to batch files but would appreciate any help. TIA My process thus far has been the following: I edited the...
5
6454
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, Zip that copied file to the same directory location and delete the copied file. The ultimate goal here is to create small sized back ups of the original database. I have the first part (creating the copy mdb) working great. It's zipping that...
3
2448
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 and searching I'm still not getting any results. I've tried echo exec('t:\dir\batch.bat'); as a starting point.
1
6568
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 file to do the following things. - check if a database created by that user exists if true return 1 else return 0 Anyone who knows how to do this , please help !
0
5484
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 the main one. but i cant close the 2nd cmd. i tried some ways but still didn't work. googling it didn't help it always showed me how to run batch files. this is the file /////////////////////////////////// @ECHO off echo runnung cm cmd /k ...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10318
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.