public String getCurrentDir ( ) throws IOException , ServerException { Reply reply = null ; try { reply = controlChannel . execute ( Command . PWD ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce , "Server refused returning current directory" ) ; } String strReply = reply . getMessage ( ) ; if ( strReply . length ( ) > 0 && strReply . charAt ( 0 ) == ' ' ) { return strReply . substring ( 1 , strReply . indexOf ( ' ' , 1 ) ) ; } else { throw ServerException . embedFTPReplyParseException ( new FTPReplyParseException ( 0 , "Cannot parse 'PWD' reply: " + reply ) ) ; } }
Returns remote current working directory .