Ⅰ 在FTP命令當中查看本地文件列表命令是
查看本地文件列表命令是:ls
其它常用的FTP命令及含義:
1、dir:顯示伺服器目錄和文件列表
2、cd:進入伺服器指定的目錄(dir命令可以使用通配符「」和「?」,比如,顯示當前目錄中所有擴展名為jpg的文件,可使用命令 dir .jpg。)
3、put:上傳指定文件put filename [newname]
4、、send:上傳指定文件send filename [newname]
(filename為上傳的本地文件名,newname為上傳至FTP伺服器上時使用的名字,如果不指定newname,文件將以原名上傳。)
(1)ftpget目錄所有文件擴展閱讀
ftp命令行格式及開關含義:
ftp [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-w:windowsize] [computer]
-v - 禁止顯示遠程伺服器相應信息
-n - 禁止自動登錄
-i - 多文件傳輸過程中關閉交互提示
-d - 啟用調試,顯示所有客戶端與伺服器端傳遞的命令
-g - 禁用文件名通配符,允許在本地文件和路徑名中使用
-s:filename - 指定包含 FTP 命令的文本文件;命令在FTP啟動後自動運行。此參數中沒有空格。可替代重定向符(>)使用。
-a - 在綁字數據連接時使用所有本地介面
-w:windowsize - 覆蓋默認的傳輸緩沖區大小 65535。
computer - 指定遠程電腦計算機名或IP地址。此參數必須放到最後。
Ⅱ linux ftp下如何get多個目錄的文件
1、查看是否安裝vsftpd,如果沒有用yum安裝,本系統沒有安裝。
Ⅲ java如何獲取ftp制定目錄下所有文件集合(包括文件名稱)只要一個方法。
/**
* 取得相對於當前連接目錄的某個目錄下所有文件列表
*
* @param path
* @return
*/
public List getFileList(String path){
List list = new ArrayList();
DataInputStream dis;
try {
dis = new DataInputStream(ftpClient.nameList(this.path + path));
String filename = "";
while((filename = dis.readLine()) != null){
list.add(filename);
}
} catch (IOException e) {
e.printStackTrace();
}
return list;
}
我從這里拷來的 你不清楚看看裡面 http://hi..com/yuanhotel/item/000b6334894d11f42784f4da
滿意就採納 謝謝
Ⅳ FTP命令mget如何下載整個目錄下的文件及子目錄文件
引用1個解答
ftp只是個小命令,特別多功能做不到的,可以利用其他ftp客戶端軟體
或把文件夾壓縮後用命令行上傳
以下是調出使用winrar壓縮的命令
path
c:\program
files\winrar;d:\program
files\winrar;%path%
rar
a
d:\aa.rar
d:\aa
之後在ftp的命令行里用
put
d:\aa.rar
Ⅳ 如何使用get命令利用FTP下載文件到本地
1、從遠程ftp伺服器下載文件的命令格式:
get 遠程ftp伺服器上當前目錄下要下載的文件名。
2、附上ftp常用命令,如下所示:
FTP>open [ftpservername],和指定的遠程Linux FTP伺服器連接。
FTP>user [username] [password],使用指定遠程Linux FTP伺服器的用戶登錄。
FTP>pwd,顯示遠程Linux FTP伺服器上的當前路徑。
FTP>ls,列出遠程Linux FTP伺服器上當前路徑下的目錄和文件。
FTP>dir,列出遠程Linux FTP伺服器上當前路徑下的目錄和文件(同上)。
FTP>mkdir [foldname],在遠程Linux FTP伺服器上當前路徑下建立指定目錄。
FTP>rmdir [foldname],刪除遠程Linux FTP伺服器上當前路徑下的指定目錄。
FTP>cd [foldname],更改遠程Linux FTP伺服器上的工作目錄。
FTP>delete [filename],刪除遠程Linux FTP伺服器上指定的文件。
FTP>rename [filename] [newfilename],重命名遠程Linux FTP伺服器上指定的文件。
FTP>close,從遠程Linux FTP伺服器斷開但保留FTP命令參數提示。
FTP>disconnect,從遠程Linux FTP伺服器斷開但保留FTP命令參數提示(同上)。
FTP>bye,結束和遠程Linux FTP伺服器的連接。
FTP>quit,結束和遠程Linux FTP伺服器的連接(同上)。
FTP>!,直接從遠程Linux FTP伺服器進入到本地shell中。
FTP>exit,(接上步)從本地shell環境中返回到遠程Linux FTP伺服器環境下。
FTP>!ls,列出本地機器上當前路徑下的目錄和文件。
FTP>lcd [foldname],更改本地機器的工作目錄。
Ⅵ 如何拷貝或者用ftp下載整個目錄下的文件
wangzh(獨孤求問)的代碼里還缺了一個單元的調用:filectrl。至於函數的時,查看一下幫助吧,可以解釋的是:AFormDir,
AToDir分別指源文件所在路經和目標路徑
Ⅶ C# 獲取Ftp某個目錄下的所有文件(不要文件夾)
我在之前做過一個FTP的客戶端工具。
drw 文件夾
-rw 文件(有擴展名或無擴展名)
我是根據服務端返回的報文進行分析獲取的列表。
給你一些代碼片段:
/// <summary>
/// 獲取指定目錄下的文件和文件夾。
/// </summary>
/// <param name="path">要獲取的目錄</param>
/// <param name="WRMethods">要發送到FTP伺服器的密令。</param>
/// <returns></returns>
public string[] GetFileList(string path, string WRMethods)//從ftp伺服器上獲得文件列表
{
WebResponse response;
string[] downloadFiles;
int conut = 4;
StringBuilder result = new StringBuilder();
Connect(path);
if (FTPVariable.IsUseProxy_ftp)
{
reqFTP.Proxy = FtpProxy.GetFtpSelectProxy(FTPVariable.FtpCommand_transferProxyName);
}
reqFTP.ReadWriteTimeout = 12000;
//如果不應銷毀到伺服器的連接,則為 true;否則為 false。默認值為 true。
//
reqFTP.Method = WRMethods;
try
{
response = (FtpWebResponse)reqFTP.GetResponse();
goto Ftp_lbl_03;
}
catch (WebException webex)
{
GetReply(webex.Message);
if (ReplyCode == 530)// 未登錄。
{
goto Ftp_lbl_04;
}
else if (ReplyCode == 550)
{
goto Ftp_lbl_04;
}
else
{
FtpManage.SetLog("獲取列表超時,等候1秒後重試!");
goto Ftp_lbl_01;
}
}
Ftp_lbl_01:
try
{
FtpManage.SetLog("正在連接伺服器 " + FtpRemoteHost);
response = GetRequest(path, WRMethods);
}
catch (WebException)
{
FtpManage.SetLog("獲取列表超時,等候1秒後重試!");
downloadFiles = null;
System.Threading.Thread.Sleep(1000);
if (conut == 0)
{
goto Ftp_lbl_02;
}
conut--;
goto Ftp_lbl_01;
}
catch (Exception ex)
{
MSG.Show(ex.Message, Global.GetRS["msgTilteError"], MessageBoxButton.OK, MsgIco.Error);
FtpManage.SetLog("命令執行失敗,原因:" + ex.Message);
downloadFiles = null;
return downloadFiles;
}
Ftp_lbl_03:
StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default);//中文文件名
string line = reader.ReadLine();
while (line != null)
{
result.Append(line);
result.Append("\n");
line = reader.ReadLine();
}
if (result.Length == 0)
{
return null;
}
// to remove the trailing '\n'
result.Remove(result.ToString().LastIndexOf('\n'), 1);
reader.Close();
response.Close();
FtpManage.SetLog("命令已成功執行");
return result.ToString().Split('\n');
Ftp_lbl_04:
FtpManage.SetLog(ReplyInfo);
return null;
Ftp_lbl_02:
FtpManage.SetLog("550 獲取列表失敗,無法連接遠程伺服器!");
FtpManage.ftpmanage.IsRefurbish = true;
return null;
}
/// <summary>
/// 獲取指定目錄下的文件和文件夾。
/// </summary>
/// <param name="path">要獲取的目錄</param>
/// <returns></returns>
public string[] GetFileList(string path)//從ftp伺服器上獲得文件列表
{
return GetFileList(FTPVariable.FtpURLhead + FtpRemoteHost + "/" + path, WebRequestMethods.Ftp.ListDirectory);
}
/// <summary>
/// 獲取指定目錄下的文件和文件夾。
/// </summary>
/// <returns></returns>
public string[] GetFileList()//從ftp伺服器上獲得文件列表
{
return GetFileList(FTPVariable.FtpURLhead + FtpRemoteHost + "/", WebRequestMethods.Ftp.ListDirectory);
}
/// <summary>
/// 獲取目錄和文件名,返回目錄表。
/// </summary>
/// <param name="path">要獲取的目錄</param>
/// <returns></returns>
public string[] GetCatalog_FileList(string path)
{
string[] fountainhead = GetFileList(FTPVariable.FtpURLhead + FtpRemoteHost + "/" + path, WebRequestMethods.Ftp.ListDirectoryDetails);
string[] Catalog = null;
if (fountainhead == null)
{
return null;
}
Catalog = new string[fountainhead.Length];
for (int i = 3; i < fountainhead.Length; i++)
{
Catalog[i - 3] += fountainhead[i].Substring(55, fountainhead[i].Length - 55) + "&";//FileName
Catalog[i - 3] += fountainhead[i].Substring(30, 12) + "&";//FileSize
Catalog[i - 3] += fountainhead[i].Substring(42, 13) + "&";//AmendDate
Catalog[i - 3] += fountainhead[i].Substring(0, 3) + "&";
}
return Catalog;
}
Ⅷ 怎麼獲得FTP伺服器上目錄下的所有文件名和子目錄
不要使用tidftp,長時間搜索會出現死鎖現象,使用WinInet單元
procere TFtpScan.Execute;
var
FFTPHandle: HINTERNET;
FInetHandle: HINTERNET;
Enum: HINTERNET;
FFindFileData: WIN32_FIND_DATA;
R: Boolean;
FFileName, DataStr: string;
TempErrorCode: Cardinal;
begin