If File Exists - "do not download again"

Discuss RoboTask here
Post Reply
svugger
Posts: 4
Joined: Sun Nov 26, 2006 7:47 am

If File Exists - "do not download again"

Post 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)?
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If File Exists - "do not download again"

Post 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
svugger
Posts: 4
Joined: Sun Nov 26, 2006 7:47 am

If File Exists - "do not download again"

Post 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?
svugger
Posts: 4
Joined: Sun Nov 26, 2006 7:47 am

If File Exists - "do not download again"

Post by svugger »

Or in other words: Where exactly to i put the algorithm?
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If File Exists - "do not download again"

Post 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.
svugger
Posts: 4
Joined: Sun Nov 26, 2006 7:47 am

If File Exists - "do not download again"

Post 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 :)
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If File Exists - "do not download again"

Post 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
Post Reply