473,408 Members | 1,767 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,408 software developers and data experts.

How can I copy an html file to a local drive ?

How can I copy an html file to a local drive ?
For example: I would like to copy
www.mywebsite.mypage.htm to
c:\inetput\wwwroot\mydir\mypage.htm, can I do that ?

Thanks.
Jul 22 '05 #1
1 1686
"paul fpvt2" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
How can I copy an html file to a local drive ?
For example: I would like to copy
www.mywebsite.mypage.htm to
c:\inetput\wwwroot\mydir\mypage.htm, can I do that ?

Thanks.


Try this.

Option Explicit
'*
Const cURL = "www.mywebsite.mypage.htm"
Const cOUT = "c:\inetput\wwwroot\mydir\mypage.htm"
'*
WScript.Echo "Success? " & Fetch(cURL,cOUT)

Function Fetch(xURL,xOUT)
On Error Resume Next
Fetch = False
Err.Clear
Dim objXML
Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "GET",xURL,False
objXML.Send
Dim strXML
strXML = objXML.ResponseBody
If Err.Number <> 0 _
Or objXML.Status <> 200 Then
Exit Function
End If
Set objXML = Nothing
Dim objADO
Set objADO = CreateObject("ADODB.Stream")
objADO.Type = 1
objADO.Open
objADO.Write strXML
objADO.SaveToFile xOUT,2
Set objADO = Nothing
Fetch = Err.Number = 0
End Function

It will work with binary files (e.g. images) as well.
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Somedude | last post by:
Hello, I am building a small page to copy files from our server(s) to our users local machines. It's very simple... (below, "f" is a mapped network drive) <?php $source_file =...
9
by: Josh Mayfield | last post by:
Note: There is considerable background detail here, but I do have three questions, which are clearly marked and appear right before the sample code. I have a legitimate need to launch an EXE...
3
by: Nathaniel Wingard | last post by:
I recently was asked to write a program that moved files to certain places on a network drive based on what the files were (mainly filenames since the files are mostly Office documents of various...
11
by: Mike | last post by:
I want to be able to copy a directory of files (all .HTM files) from a network drive to a local drive on the machine c:\HTMFiles , How can i do that? I tried File.Copy(source, dest) but i need...
4
by: Brian Hanson | last post by:
Hi, I have a problem that is sporadic and am thinking it may come down to a timing issue. I have an asp.net (vb) app that used the system.io.file.copy method to copy a .pdf file from a network...
4
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new...
2
by: Cliff72 | last post by:
Is there a way in VBA to copy a file from a web server to a local drive? Example: Every morning at 3AM a huge mainframe report is run and a copy of this report is saved as a text file on a web...
1
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
Using .NET 2.0 is it more efficient to copy files to a single folder versus spreading them across multiple folders. For instance if we have 100,000 files to be copied, Do we copy all of them to...
1
by: thanawala27 | last post by:
Hi, I have mapped a server to my computer (called it H drive). all my perl scripts run on the server. Now, i would like to copy a file from my local hard disk (C drive) to this server. As my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.