public Date getLastModified ( String filename ) throws IOException , ServerException { if ( filename == null ) { throw new IllegalArgumentException ( "Required argument missing" ) ; } Command cmd = new Command ( "MDTM" , filename ) ; Reply reply = null ; try { reply = controlChannel . execute ( cmd ) ; } catch ( FTPReplyParseException rpe ) { throw ServerException . embedFTPReplyParseException ( rpe ) ; } catch ( UnexpectedReplyCodeException urce ) { throw ServerException . embedUnexpectedReplyCodeException ( urce , "Server refused changing transfer mode" ) ; } if ( dateFormat == null ) { dateFormat = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ; dateFormat . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; } try { return dateFormat . parse ( reply . getMessage ( ) ) ; } catch ( ParseException e ) { throw ServerException . embedFTPReplyParseException ( new FTPReplyParseException ( 0 , "Invalid file modification time reply: " + reply ) ) ; } }
Returns last modification time of the specifed file .