Hi all.

In this URL is the SDN.xml file

http://www.treas.gov/offices/enforcement/ofac/sdn/sdn.xml

I need to automatically copy the file to hard disk.

Thanks for your help.

Re: Copy XML from HTTP URL to hard disk? by Pegasus

Pegasus
Wed May 07 13:22:27 CDT 2008


"rdreyes" <rdreyes@discussions.microsoft.com> wrote in message
news:D8788222-F623-4FBA-890A-1F6469C9DB98@microsoft.com...
> Hi all.
>
> In this URL is the SDN.xml file
>
> http://www.treas.gov/offices/enforcement/ofac/sdn/sdn.xml
>
> I need to automatically copy the file to hard disk.
>
> Thanks for your help.
>

Try this:
wget http://www.treas.gov/offices/enforcement/ofac/sdn/sdn.xml
(http://www.interlog.com/~tcharron/wgetwin.html)



Re: Copy XML from HTTP URL to hard disk? by Tom

Tom
Wed May 07 15:31:40 CDT 2008

On May 7, 2:08 pm, rdreyes <rdre...@discussions.microsoft.com> wrote:
> Hi all.
>
> In this URL is the SDN.xml file
>
> http://www.treas.gov/offices/enforcement/ofac/sdn/sdn.xml
>
> I need to automatically copy the file to hard disk.
>
> Thanks for your help.

Or without requiring a third party download ...

sURL = "http://www.treas.gov/offices/enforcement/ofac/sdn/sdn.xml"
aTemp = split(sURL, "/")
sFileName = aTemp(Ubound(aTemp))
sFilePath = ".\" ' current active folder - modify as needed
DownBinFile(sFilePath & sFileName, sURL)
wsh.echo "Done"

' Source Michael Harris & Alex K. Angelopoulos
' modified by TGL 2003 - 2008
' http://groups.google.com/groups?selm=OxJBkB8xCHA.2120%40TK2MSFTNGP11
&
' http://www.google.com/groups?selm=%23v1%23CmirAHA.2132%40tkmsftngp05
'
Sub DownBinFile(FilePath, sURL)
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2

' Create an xmlhttp object:
set oXML = CreateObject("MSXML2.XMLHTTP")
oXML.open "GET", sURL, False
oXML.send
If (oXML.Status = 200) Then
with CreateObject("ADODB.Stream")
.Open
.Type = adTypeBinary
.Write oXML.ResponseBody
.SaveToFile FilePath, adSaveCreateOverWrite
.Close
end with ' oStream
Else
WScript.Echo "Error Number: " & oXML.Status
WScript.Echo "Error Text: " & oXML.StatusText
End If
End Sub

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Re: Copy XML from HTTP URL to hard disk? by rdreyes

rdreyes
Wed May 07 16:42:01 CDT 2008


Thanks for your help.





Re: Copy XML from HTTP URL to hard disk? by rdreyes

rdreyes
Wed May 07 16:53:01 CDT 2008

Thanks for your help.

This is perfect.