List of usage examples for org.apache.commons.net.ftp FTPCmd MFMT
FTPCmd MFMT
To view the source code for org.apache.commons.net.ftp FTPCmd MFMT.
Click Source Link
From source file:ch.cyberduck.core.ftp.FTPSession.java
@Override public void login(final HostPasswordStore keychain, final LoginCallback prompt, final CancelCallback cancel) throws BackgroundException { try {/*from w w w . j a v a2 s . c o m*/ if (client.login(host.getCredentials().getUsername(), host.getCredentials().getPassword())) { if (host.getProtocol().isSecure()) { client.execPBSZ(0); // Negotiate data connection security client.execPROT(preferences.getProperty("ftp.tls.datachannel")); } if ("UTF-8".equals(host.getEncoding())) { if (client.hasFeature("UTF8")) { if (!FTPReply.isPositiveCompletion(client.sendCommand("OPTS UTF8 ON"))) { log.warn( String.format("Failed to negotiate UTF-8 charset %s", client.getReplyString())); } } } final TimeZone zone = host.getTimezone(); if (log.isInfoEnabled()) { log.info(String.format("Reset parser to timezone %s", zone)); } String system = null; //Unknown try { system = client.getSystemType(); if (system.toUpperCase(Locale.ROOT).contains(FTPClientConfig.SYST_NT)) { casesensitivity = Case.insensitive; } } catch (IOException e) { log.warn(String.format("SYST command failed %s", e.getMessage())); } listService = new FTPListService(this, keychain, prompt, system, zone); if (client.hasFeature(FTPCmd.MFMT.getCommand())) { timestamp = new FTPMFMTTimestampFeature(this); } else { timestamp = new FTPUTIMETimestampFeature(this); } permission = new FTPUnixPermissionFeature(this); if (client.hasFeature("SITE", "SYMLINK")) { symlink = new FTPSymlinkFeature(this); } } else { throw new FTPExceptionMappingService() .map(new FTPException(this.getClient().getReplyCode(), this.getClient().getReplyString())); } } catch (IOException e) { throw new FTPExceptionMappingService().map(e); } }
From source file:com.atomicleopard.thundr.ftp.commons.FTP.java
/** * A convenience method to send the FTP MFMT command to the server, * receive the reply, and return the reply code. * <p>// w w w . j av a2s. c o m * @param pathname The pathname for which mtime is to be changed * @param timeval Timestamp in <code>YYYYMMDDhhmmss</code> format * @return The reply code received from the server. * @exception FTPConnectionClosedException * If the FTP server prematurely closes the connection as a result * of the client being idle or some other reason causing the server * to send FTP reply code 421. This exception may be caught either * as an IOException or independently as itself. * @exception IOException If an I/O error occurs while either sending the * command or receiving the server reply. * @since 2.2 * @see <a href="http://tools.ietf.org/html/draft-somers-ftp-mfxx-04">http://tools.ietf.org/html/draft-somers-ftp-mfxx-04</a> **/ public int mfmt(String pathname, String timeval) throws IOException { return sendCommand(FTPCmd.MFMT, timeval + " " + pathname); }