public static Integer getFileSizeOnFTPServer ( String hostName , Integer port , String userName , String password , String filePath ) { Integer result = null ; // get file size String replyString = executeCommandOnFTPServer ( hostName , port , userName , password , "SIZE" , filePath ) ; if ( replyString == null || ! replyString . contains ( " " ) ) { throw new RuntimeException ( String . format ( "Unable to get size of the %s file. Got [%s] reply from FTP server." , filePath , replyString ) ) ; } else { result = Integer . valueOf ( replyString . split ( " " ) [ 1 ] . replaceAll ( "[\r\n]" , "" ) ) ; } return result ; }
Get size of the FTP file .