ftp服务器端文件列表
㈠ C#.net怎么获得ftp服务器上文件列表
网上找个ftp类,那里面有现成的方法.直接调用就行了.
㈡ FTP 怎么查看本地的文件列表
一个简单的问题,ftp到远程服务器之后需要上传一个文件,但是我忘记了本地需要上传的文件名,因此需要查看本地目录。
解决方法:
一、cd到本地目录
二、ls命令查看本地目录的内容。
㈢ 易语言如何获取FTP服务器文件列表,并显示到列表框,有知道的回答下,问了全世界都没人知道
文件号 = 写到文件 (取运行目录 () + “自己取名字”, HTTP读文件 (“自己的FTP列表”))
循环判断首 ()
列表框1.加入项目 (读入一行 (文件号), )
循环判断尾 (是否在文件尾 (文件号, ) = 假)
㈣ VB怎么获得FTP服务器的文件以及文件夹列表
public strData as string
'这段可以返回服务器中的第一级目录名,保存在strData中, 如有多个文件夹名每个文件夹名会以空格分开。读取时判段一下。
Inet1.Execute Inet1.URL, "dir """ & dirName & """"
Do
DoEvents
Loop While Inet1.StillExecuting = True
msgbox strData
'这段是进入目录中,要想获得服务器中所有的文件夹名,就可以用递规的办法来获得。
Inet1.Execute Inet1.URL, "cd """ & dirName & """"
Do
DoEvents
Loop While Inet1.StillExecuting = True
Private Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case 1
StatusBar1.Panels.Item(1).Text = "该控件正在查询所指定的主机的 IP 地址"
Case 2
StatusBar1.Panels.Item(1).Text = "该控件已成功地找到所指定的主机的 IP 地址"
Case 3
StatusBar1.Panels.Item(1).Text = "该控件正在与主机连接"
Case 4
StatusBar1.Panels.Item(1).Text = "该控件已与主机连接成功"
Case 5
StatusBar1.Panels.Item(1).Text = "该控件正在向主机发送请求"
Case 6
StatusBar1.Panels.Item(1).Text = "该控件发送请求已成功"
Case 7
StatusBar1.Panels.Item(1).Text = "该控件正在接收主机的响应"
Case 8
StatusBar1.Panels.Item(1).Text = "该控件已成功地接收到主机的响应"
Case 9
StatusBar1.Panels.Item(1).Text = "该控件正在解除与主机的连接"
Case 10
StatusBar1.Panels.Item(1).Text = "该控件已成功地与主机解除了连接"
Case 11
MsgBox "与主机通讯时出现了错误", vbInformation, "个人资料"
Case 12
Dim vtData As Variant
Dim bDone As Boolean
bDone = False
'取得第一个块。
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone
strData = strData & vtData
'取得下一个块。
vtData = Inet1.GetChunk(1024, icString)
DoEvents
If Len(vtData) = 0 Then
bDone = True
End If
Loop
StatusBar1.Panels.Item(1).Text = "该请求已经完成,并且所有数据均已接收到"
Case Else
StatusBar1.Panels.Item(1).Text = Inet1.ResponseCode & ": " & Inet1.ResponseInfo
End Select
End Sub
㈤ 关于获取FTP服务器上文件列表的问题
谢谢,虽然不会,但是能否给个幸运分?
㈥ 如何用C#获取FTP服务器文件列表
比如1写个webservice在客户端调用一点一点传2开个ftp在server上客户端使用ftp命名空间操作上传.3服务器开启个socket客户端连接并且把文件转成byte发过去.
㈦ linux下用ftp命令连接到ftp服务器应该如何查看服务器上的目录文件数
1.Linux下启动ftp
ls -l 普通文件就是以 - 开头,文件夹以 d 开头,grep 后面接正则表达式:^- 以 - 开头的匹配。
(7)ftp服务器端文件列表扩展阅读:
1.查看当前目录下的文件数量(不包含子目录中的文件):
ls -l|grep "^-"| wc -l
2. 查看当前目录下的文件数量(包含子目录中的文件):
ls -lR|grep "^-"| wc -l
3.查看当前目录下的文件夹目录个数,(不包含子目录中的目录):
ls -l|grep "^d"| wc -l
4.查询当前路径下的指定前缀名的目录下的所有文件数量 例如:统计所有以“20161124”开头的目录下的全部文件数量:
ls -lR 20161124*/|grep "^-"| wc -l
㈧ ftp有关...DIR怎么不能显示文件列表
你这种情况是服务器端ftp服务器软件的设置问题。
例如:serv-u的软件中,在设置用户访问权限的时候,目录访问中有一项是“列表”的选项。
这个选项的功能就是是否让登陆用户看到里面的文件列表。如果这个选项没选上,那么用户登录后就是你这种情况。
这样做就是为了便于很多网站提供在ftp里面的软件下载工作,让用户可以下载,但是看不到里面的东西。
就这样啦,你如果想要看到,只能到服务器端去把这个权限给您加上。那样就可以了。
㈨ 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服务器突然关机了,文件传输列表没有了,怎么找到
原因:跟SELinux有关
解决方法:关闭SELinux
查看SELinux状态:/usr/sbin/sestatus -v #如果SELinux status参数为enabled即为开启状态
方法一:临时关闭(不用重启机器)
setenforce 0 #设置SELinux 成为permissive模式
#setenforce 1 设置SELinux 成为enforcing模式
方法二:修改配置文件需要重启机器
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可