Ⅰ 在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