List of usage examples for org.apache.commons.net.ftp FTPReply DIRECTORY_STATUS
int DIRECTORY_STATUS
To view the source code for org.apache.commons.net.ftp FTPReply DIRECTORY_STATUS.
Click Source Link
From source file:org.apache.maven.wagon.providers.ftp.FtpWagon.java
public boolean resourceExists(String resourceName) throws TransferFailedException, AuthorizationException { Resource resource = new Resource(resourceName); try {//from ww w . j av a 2 s . c o m ftpChangeDirectory(resource); String filename = PathUtils.filename(resource.getName()); int status = ftp.stat(filename); return ((status == FTPReply.FILE_STATUS) || (status == FTPReply.DIRECTORY_STATUS) || (status == FTPReply.FILE_STATUS_OK) // not in the RFC but used by some FTP servers || (status == FTPReply.COMMAND_OK) // not in the RFC but used by some FTP servers || (status == FTPReply.SYSTEM_STATUS)); } catch (IOException e) { throw new TransferFailedException("Error transferring file via FTP", e); } catch (ResourceDoesNotExistException e) { return false; } }