Topic "FileExists says file exists even when it does not"

Author Message
Karen Healey

Guest


I am using the latest WinSCP, just downloaded today on Windows 7. I copied your VB example

http://winscp.net/eng/docs/library_session_getfiles#example

The line : If mySession.FileExists(remotePath) Then

always returns true, even though the file does not exist. Then, it "gets" an empty file. Session log is attached.

What am I doing wrong?

Thank you,

Karen Healey
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
As you can see in the log, your server provides information (possibly fake) for the file /infiles/dhcdheat/export20141103.txt as if it existed.

Quote:
> 2014-11-03 16:25:43.869 Script: stat -- "/infiles/dhcdheat/export20141103.txt"
. 2014-11-03 16:25:43.869 Listing file "/infiles/dhcdheat/export20141103.txt".
> 2014-11-03 16:25:43.869 Type: SSH_FXP_LSTAT, Size: 45, Number: 263
< 2014-11-03 16:25:43.884 Type: SSH_FXP_ATTRS, Size: 13, Number: 263
. 2014-11-03 16:25:43.884 export20141103.txt;-;0;1899-12-30T05:00:00.000Z;"" [0];"" [0];r-xr-xr-x;0
< 2014-11-03 16:25:43.884 Script: -r-xr-xr-x 0 0 Dec 30 0:00:00 1899 export20141103.txt


If the file does not exist, it's a server-side bug.

Last edited by martin on 2014-11-07; edited 1 time in total
Guest




Oh.. thanks! The file definitely does not exist because I was deliberately testing that scenario. I'm not sure why the server is reporting that it does exist. That is very strange.

I'll find a work around.

Thank you,

Karen Healey
Guest




Why would the server say that a file exists when it doesn't? Is this possibly a response from a non-Windows server?

Thanks,

Karen Healey
Guest




In addition, GetFileInfo is returning invalid information even when the file exists. I wanted to check for a length of 0 but even files that exist have a length of 0 according to GetFileInfo. Clearly, the server is returning invalid information, but the question remains, Why?

Thanks,

Karen Healey
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
In addition, GetFileInfo is returning invalid information even when the file exists. I wanted to check for a length of 0 but even files that exist have a length of 0 according to GetFileInfo. Clearly, the server is returning invalid information, but the question remains, Why?

No idea. What is your server? I didn't checked before removing the log file.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License