Page 1 of 1

If File Exists - "do not download again"

Posted: Sun Nov 26, 2006 8:05 am
by svugger
I'm checking for a file on a website every two hours (via the recycle function).But I can only tell it to overwrite or rename the file, once it's downloaded.Can I command it to simply ignore the file, after it have been downloaded (it has to be sure the filesize is the same before ignoring it)?

If File Exists - "do not download again"

Posted: Mon Nov 27, 2006 5:30 am
by Oleg
There is system variable {FileExists()}. You may pass full file name as parameter. This variable returns True if file exists and False otherwise.
See more variables by using menu "Options | Variables". There are such variables as {FileSize()} and {FileTime()}

Use the following algorithm:

if {FileExists(c:\incoming\myfile.dat)}=false then
   Download the file
end if

If File Exists - "do not download again"

Posted: Mon Nov 27, 2006 2:00 pm
by svugger
Thanks a lot for the answer Oleg, now I hope I don't get slapped for asking this:I used your fine algorithm and copy/pasted it into the "Save in Folder", so it looks like this:C:\Documents and Settings\svugger\Desktop\banner if {FileExists(C:\Documents and settings\svugger\Desktop\banner\test.pdf)}=false then Download the file end ifI have a feeling I'm using them wrongly together, because it doesn't work for me.Also if I were to add something that checked if the file were already being downloaded, where would i then put that? before or after? and in the same line?

If File Exists - "do not download again"

Posted: Wed Nov 29, 2006 5:43 am
by svugger
Or in other words: Where exactly to i put the algorithm?

If File Exists - "do not download again"

Posted: Thu Nov 30, 2006 7:53 am
by Oleg
What do you want to do? Why do you need to check the file on web site every two hours?
Do you want to check the size of file?
Where do you want to download the file from?

Describe your task in more detail, please and I'll try to write an example for you.

If File Exists - "do not download again"

Posted: Thu Nov 30, 2006 11:57 am
by svugger
sorry for being so unclear - here is the task:I want to download this file: http://jaist.dl.sourceforge.net/sourcef ... x/Morphing Morphix_0.3.1.isoIF the file is not there, it should check for the file again once every 2 hours.The file should be downloaded to my harddrive here: C:\test\If the file is already there (same size/name), the task should stop (i.e. no more checking for the file every 2 hours).If the file is in the process of being downloaded, i don't want to have that interrupted in any way (i.e being overwritten while downloading or something like that).Hope it's more clear now, and thx for not having given totally up on me :)

If File Exists - "do not download again"

Posted: Fri Dec 01, 2006 12:19 am
by Oleg
Generally, you can't determine the file size on HTTP server without downloading the file. Thus you should download the file every time in order to compare sizes of the files.
However see this example. This task checks the file existence in c:\test folder, and, if the file doesn't exist, downloads it