public boolean exists(String filename)
        throws IOException, ServerException {
        if (filename == null) {
            throw new IllegalArgumentException("Required argument missing");
        }
        try {
            Reply reply =
                controlChannel.exchange(new Command("RNFR", filename));
            if (Reply.isPositiveIntermediate(reply)) {
                controlChannel.execute(new Command("ABOR"));
                return true;
            } else {
                return false;
            }
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Abort failed");
        }
    }
public boolean exists ( String filename ) throws IOException , ServerException { if ( filename == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } try { Reply reply = controlChannel . exchange ( new Command ( "RNFR" , filename ) ) ; if ( Reply . isPositiveIntermediate ( reply ) ) { controlChannel . execute ( new Command ( "ABOR" ) ) ; return true ; } else { return false ; } } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce , "Abort failed" ) ; } }
Checks if given file/directory exists on the server.

@param  filename
file or directory name
@return true if the file exists, false otherwise.