org.shept.util
public class FtpFileCopy extends Object
| Modifier and Type | Field and Description |
|---|---|
private static org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
FtpFileCopy() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
acceptFile(org.apache.commons.net.ftp.FTPFile file,
String pattern) |
private boolean |
configSetup(FtpConfig config,
org.apache.commons.net.ftp.FTPClient ftpC) |
private boolean |
ensureFtpDirectory(org.apache.commons.net.ftp.FTPClient ftpClient,
String basePath,
String path)
Creates the needed directories if necessary.
|
SortedMap<FileNameDate,org.apache.commons.net.ftp.FTPFile> |
fileMapByNameAndDate(org.apache.commons.net.ftp.FTPClient ftp,
String filePattern)
List the file directory as specified by the name filter and the path directory
The maps keys contain name and modification date for comparison
|
int |
ftpSyncLocal(FtpConfig config,
String localPath,
String filePattern) |
int |
ftpSyncRemote(FtpConfig config,
String remotePath,
String filePattern) |
Integer |
syncPull(org.apache.commons.net.ftp.FTPClient ftpSource,
String localDestPat,
String filePattern)
Compare the source path and the destination path for filenames with the filePattern
e.g.
|
Integer |
syncPush(String localSourcePath,
org.apache.commons.net.ftp.FTPClient ftpDest,
String filePattern)
Compare the source path and the destination path for filenames with the filePattern
e.g.
|
private boolean configSetup(FtpConfig config, org.apache.commons.net.ftp.FTPClient ftpC) throws IOException
- config - ftpC - SocketExceptionIOExceptionpublic Integer syncPull(org.apache.commons.net.ftp.FTPClient ftpSource, String localDestPat, String filePattern) throws IOException
ftpSource - localDestPat - filePattern - IOExceptionpublic Integer syncPush(String localSourcePath, org.apache.commons.net.ftp.FTPClient ftpDest, String filePattern) throws IOException
destPath - localSourcePath - filePattern - IOExceptionpublic SortedMap<FileNameDate,org.apache.commons.net.ftp.FTPFile> fileMapByNameAndDate(org.apache.commons.net.ftp.FTPClient ftp, String filePattern) throws IOException
IOExceptionprotected boolean acceptFile(org.apache.commons.net.ftp.FTPFile file,
String pattern)
private boolean ensureFtpDirectory(org.apache.commons.net.ftp.FTPClient ftpClient,
String basePath,
String path)
throws IOException
ftpClient - A FTPClient being connected.basePath - The base path. This one has to exist on the ftp server!path - The path to be created.IOException - IN case of an error.Copyright © 2014. All Rights Reserved.