Jump to content

Check if a file exists on internet


DCCD
 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...