You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Pandit <pa...@hotmail.com> on 2004/01/02 14:54:03 UTC
File exists or not
Hi all,
I'm trying to retrive a file from a FTP server. Before, retrieving I need
to check if the file exists. How should I do this?
I tried using this,
FTPFile list[] = getFTPClient().listFiles(fileName);
if ( list != null ) {
exists = true;
}
But this doesn't seems to work. Even though the file doesn't exists, the
variable "list" isn't null. This logic doesn't seems to work. Could
someone guide me how I need to code if I need to verify if the file exists
or not?
Thanks in advance,
Pandit.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
RE: [OT] File exists or not
Posted by Greg Dunn <gr...@mo.nisc.cc>.
list[0] != null
Greg
-----Original Message-----
From: Pandit [mailto:pandith_44@hotmail.com]
Sent: Friday, January 02, 2004 7:54 AM
To: commons-user@jakarta.apache.org
Subject: File exists or not
Hi all,
I'm trying to retrive a file from a FTP server. Before, retrieving I need
to check if the file exists. How should I do this?
I tried using this,
FTPFile list[] = getFTPClient().listFiles(fileName);
if ( list != null ) {
exists = true;
}
But this doesn't seems to work. Even though the file doesn't exists, the
variable "list" isn't null. This logic doesn't seems to work. Could
someone guide me how I need to code if I need to verify if the file exists
or not?
Thanks in advance,
Pandit.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org