SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
FTPFileExists

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
FTPFileExists
Author Message
Matt R



Joined: 26 Sep 2002
Posts: 10

Post FTPFileExists Reply with quote

I can't seem to get a FALSE return value from FTPFileExists.

I'm connecting to a Solaris 8 system as root and all directories and files are lowercase.

The file I specify doesn't exist, but a call to the function still returns TRUE.

Am I doing something wrong?

Thu Sep 26, 2002 2:30 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPFileExists Reply with quote

Did the file exist before?

: I can't seem to get a FALSE return value from FTPFileExists.

: I'm connecting to a Solaris 8 system as root and all directories and files
: are lowercase.

: The file I specify doesn't exist, but a call to the function still returns
: TRUE.

: Am I doing something wrong?

Thu Sep 26, 2002 2:35 pm View user's profile Send private message
Matt R



Joined: 26 Sep 2002
Posts: 10

Post Re: FTPFileExists Reply with quote

: Did the file exist before?

Yes.

I'm trying to monitor for the existance of a file and it's stable size, then I'll process it and rename or move it when done.

Thu Sep 26, 2002 2:40 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPFileExists Reply with quote

This could be caused by Windows caching data between connections.
If you are using Internet Explorer go to Tools/Internet Options menu, Temporary Internet Files options, Settings button. In the "Check for newer versions of stored pages" set "Every visit to the page". Re-run the job. If that does not help, please let us know.

: Yes.

: I'm trying to monitor for the existance of a file and it's stable size, then
: I'll process it and rename or move it when done.

Thu Sep 26, 2002 2:49 pm View user's profile Send private message
Matt R



Joined: 26 Sep 2002
Posts: 10

Post Re: FTPFileExists Reply with quote

: This could be caused by Windows caching data between connections.
: If you are using Internet Explorer go to Tools/Internet Options menu,
: Temporary Internet Files options, Settings button. In the "Check for
: newer versions of stored pages" set "Every visit to the
: page". Re-run the job. If that does not help, please let us know.

IE is already set that way on my pc. Any other suggestions?

Thu Sep 26, 2002 3:15 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPFileExists Reply with quote

Some data is obviously is cached somewhere.

Try using FTPDIR instead of FTPFileExists
Here is an example

// Was FTPFileExists( "server", "user", "pass", "file", var )

// Now
Dim( list_var, string )
FTPDir( "server", "user", "pass", "file", list_var )
NotEqual( list_var, "", var )

This is equivalent in functionality to FTPFileExists. By the way, if you run the modified script in the debugger you can see what files will be found on the remote FTP server.

: IE is already set that way on my pc. Any other suggestions?

Thu Sep 26, 2002 3:46 pm View user's profile Send private message
Matt R



Joined: 26 Sep 2002
Posts: 10

Post Re: FTPFileExists Reply with quote

: Some data is obviously is cached somewhere.

: Try using FTPDIR instead of FTPFileExists
: Here is an example

: // Was FTPFileExists( "server", "user", "pass",
: "file", var )

: // Now
: Dim( list_var, string )
: FTPDir( "server", "user", "pass",
: "file", list_var )
: NotEqual( list_var, "", var )

: This is equivalent in functionality to FTPFileExists. By the way, if you run
: the modified script in the debugger you can see what files will be found
: on the remote FTP server.

Running code like what you have above in the debugger results in:

LIST_VAR = "rxdata.txt: No such file or directory"

The directory is completely empty. Would you have expected that value in LIST_VAR or would you have expected to see "" as the result?

After creating a file called rxdata.txt in the directory and rerunning the code, LIST_VAR="rxdata.txt", which I suspect is what you would expect.

BTW, Thanks VERY much for your quick responses.

-Matt

Thu Sep 26, 2002 5:25 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7955

Post Re: FTPFileExists Reply with quote

Ah... a "nice" non-standard response from your FTP server.
Of course an empty string "" was expected, but at least you know how to deal with this problem.

Please change NotEqual line to the following:

NotEqual( list_var, "rxdata.txt: No such file or directory", var )

A more generic approach for a file existence check would be to search "No such file" sub-string within the returned directory list. If you have many jobs using FTPFileExists statement you may want to create a user-defined function in the script library and use it instead of the built-in FTPFileExists statement.

Such user-defined statement may have 4 parameters of string type: server, user, password, and file and have the following code

--------------------------
Dim( file_list, string )
Dim( no_such_file, number )
Dim( not_found, boolean )

FTPDir( server, user, password, file, file_list )
IsEuqual( file_list, "", not_found )
IfThen( not_found, FAILURE )

InStr( file_list, "No such file", 1, no_such_file )
IfThen( no_such_file, FAILURE )
Return TRUE

FAILURE:
Return False

---------------------------
If you call this statement myFTPFileExists then everywhere in place of FTPFileExists you would put myFTPFileExists.

: Running code like what you have above in the debugger results in: LIST_VAR =
: "rxdata.txt: No such file or directory"

: The directory is completely empty. Would you have expected that value in
: LIST_VAR or would you have expected to see "" as the result?

: After creating a file called rxdata.txt in the directory and rerunning the
: code, LIST_VAR="rxdata.txt", which I suspect is what you would
: expect.

: BTW, Thanks VERY much for your quick responses.

: -Matt

Thu Sep 26, 2002 5:58 pm View user's profile Send private message
Matt R



Joined: 26 Sep 2002
Posts: 10

Post Re: FTPFileExists Reply with quote

Thanks again for the help!

: Ah... a "nice" non-standard response from your FTP server.
: Of course an empty string "" was expected, but at least you know
: how to deal with this problem.

: Please change NotEqual line to the following: NotEqual( list_var,
: "rxdata.txt: No such file or directory", var )

: A more generic approach for a file existence check would be to search
: "No such file" sub-string within the returned directory list. If
: you have many jobs using FTPFileExists statement you may want to create a
: user-defined function in the script library and use it instead of the
: built-in FTPFileExists statement.

: Such user-defined statement may have 4 parameters of string type: server,
: user, password, and file and have the following code

: --------------------------
: Dim( file_list, string )
: Dim( no_such_file, number )
: Dim( not_found, boolean )

: FTPDir( server, user, password, file, file_list )
: IsEuqual( file_list, "", not_found )
: IfThen( not_found, FAILURE )

: InStr( file_list, "No such file", 1, no_such_file )
: IfThen( no_such_file, FAILURE )
: Return TRUE

: FAILURE: Return False

: ---------------------------
: If you call this statement myFTPFileExists then everywhere in place of
: FTPFileExists you would put myFTPFileExists.

Fri Sep 27, 2002 8:15 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.