資源簡介
支持FTP開發(fā)的一個程序,可用與上傳下載文件,可用

代碼片段和文件信息
/*
?*?
?*?Copyright?(C)?2006?Enterprise?Distributed?Technologies?Ltd
?*?
?*?www.enterprisedt.com
?*/
import?com.enterprisedt.net.ftp.FileTransferClient;
import?com.enterprisedt.util.debug.Level;
import?com.enterprisedt.util.debug.Logger;
public?class?ChangeDirectory?{
????public?static?void?main(String[]?args)?{
????????//?we?want?remote?host?user?name?and?password
????????if?(args.length?3)?{
????????????System.out
????????????????????.println(“Usage:?run?remote-host?username?password?directory“);
????????????System.exit(1);
????????}
????????//?extract?command-line?arguments
????????String?host?=?args[0];
????????String?username?=?args[1];
????????String?password?=?args[2];
????????String?dir?=?args[3];
????????//?set?up?logger?so?that?we?get?some?output
????????Logger?log?=?Logger.getLogger(ChangeDirectory.class);
????????Logger.setLevel(Level.INFO);
????????FileTransferClient?ftp?=?null;
????????try?{
????????????//?create?client
????????????log.info(“Creating?FTP?client“);
????????????ftp?=?new?FileTransferClient();
????????????//?set?remote?host
????????????ftp.setRemoteHost(host);
????????????ftp.setUserName(username);
????????????ftp.setPassword(password);
????????????//?connect?to?the?server
????????????log.info(“Connecting?to?server?“?+?host);
????????????ftp.connect();
????????????log.info(“Connected?and?logged?in?to?server?“?+?host);
????????????log.info(“Current?dir:?“?+?ftp.getRemoteDirectory());
????????????log.info(“Changing?directory“);
????????????ftp.changeDirectory(dir);
????????????log.info(“Current?dir:?“?+?ftp.getRemoteDirectory());
????????????log.info(“Changing?up“);
????????????ftp.changeToParentDirectory();
????????????log.info(“Current?dir:?“?+?ftp.getRemoteDirectory());
????????????//?Shut?down?client
????????????log.info(“Quitting?client“);
????????????ftp.disconnect();
????????????log.info(“Example?complete“);
????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\net\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\net\ftp\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\net\ftp\class-use\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\util\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\util\class-use\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\util\debug\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\util\debug\class-use\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\util\proxy\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\com\enterprisedt\util\proxy\class-use\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\api\resources\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\manual\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\manual\html\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\manual\images\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\doc\manual\rfc\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\change_directories\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\connect_to_an_FTP_server\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\get_a_directory_listing\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\monitor_transfers_and_commands\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\pause_and_resume_transfers\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\set_up_logging\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\transfer_using_streams\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\upload_download_and_delete_a_file\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\use_active_passive_mode\
?????目錄???????????0??2012-12-24?12:36??edtftpj-2.4.0\examples\howto\use_binary_ascii_mode\
............此處省略431個文件信息
評論
共有 條評論