Jump to content
Sign in to follow this  
DCCD

Check if a file exists on internet

Recommended Posts

DCCD

Hi,

here's my code, But Is there any other way Like "FileExists"?

$qq = InetGetSize("http://sites.google.com/site/carshoppage/javascript/archive.zip")
If $qq = 22 Then
    MsgBox(4096, "archive.zip", "Exists.................")
Else
    MsgBox(4096, "archive.zip", "Not Exists.................")
EndIf

Share this post


Link to post
Share on other sites
dantay9

You can do Inetget for the download site and do something depending on the return value.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
Spiff59

If (InetGetSize("http://www.autoitscript.com/autoit3/files/beta/update.dat")) Then Msgbox(1,"","File Exists")

That's what I've seen decided upon in other threads, your example seems to be the way to go.

Edit: Had I looked closer at your example, I wouldn't have bothered replying. You have it right already, and what could be simpler?

Edited by Spiff59

Share this post


Link to post
Share on other sites
Authenticity

You mean other way like faster? or shorter?

#include <INet.au3>
Dim $sRet = _INetGetSource("http://sites.google.com/site/carshoppage/javascript/archive.zip")
If StringLeft($sRet, 2) == "PK" Then
    ConsoleWrite("File found" & @LF)
Else
    ConsoleWrite("File not found" & @LF)
EndIf

Return the PK{version} header of the ZIP file or the first dword in short.

Share this post


Link to post
Share on other sites
Authenticity

Lol, I see a much shorter way ;]

#include <INet.au3>
Dim $sURL = "http://sites.google.com/site/carshoppage/javascript/archive.zip"

If StringLeft(_INetGetSource($sURL), 2) == "PK" Then ...

Take into consideration that "PK" is just for ZIP files, it may be "MZ" for EXE etc...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.