❶ qt能否直接从ftp服务器上读取文本文件内容
用QFtp应该可以做到吧, 摘自Qt的帮助文档, QFtp::get()时将次二哥参数设置为0,之后收到 readyRead()后可以通过read()或readAll()读取到内存里。
int QFtp::get ( const QString & file, QIODevice * dev = 0, TransferType type = Binary )
If dev is 0, then the readyRead() signal is emitted when there is data available to read. You can then read the data with the read() or readAll() functions.
❷ qt中怎么从ftp服务器中读取文件,并存入到sq
sqlite可以存储BLOB格式(文件),你把 文件流保存在本地,然后用QFileInfo就可以获取文件信息了。。。不过嘛,还是建议不要把整个文件存在数据库中
❸ 在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,文件将以原名上传。)
(3)qt中ftp如何获取文件列表扩展阅读
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地址。此参数必须放到最后。
❹ FTP 怎么查看本地的文件列表
一个简单的问题,ftp到远程服务器之后需要上传一个文件,但是我忘记了本地需要上传的文件名,因此需要查看本地目录。
解决方法:
一、cd到本地目录
二、ls命令查看本地目录的内容。
❺ qt中连接到ftp服务器上后怎么获取服务下所有的文件名
操作方法如下:
@echo off
set h=192.168.1.100
set u=ftpuser
set p=12345678
echo open %h%>ftp.txt
echo %u%>>ftp.txt
echo %p%>>ftp.txt
echo dir>>ftp.txt
echo bye>>ftp.txt
ftp -s:ftp.txt>ftpdir.txt
echo open %h%>ftp.txt
echo %u%>>ftp.txt
echo %p%>>ftp.txt
for /f "tokens=4" %%i in ('findstr "<DIR>" ftpdir.txt') do (
echo cd %%~i>>ftp.txt
echo dir>>ftp.txt
echo cd ..>>ftp.txt)
echo bye>>ftp.txt
ftp -s:ftp.txt>ftpfile.txt
notepad ftpfile.txt
❻ 如何用FTP获取文件
如果是通过命令行交互式的:
1.
ftp
server_ip
2.
提示输入用户名:输入你的ftp用户名
3.
提示输入密码:输入ftp用户的密码
4.
切换为bin模式:b或者bin命令
5.
用get命令接完整文件名:get
your_file
6.
用wget+通配符模式获取多个文件:wget
*.txt
7.
退出ftp:bye
❼ 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获取文件
2)当FTP站点打开后,将出现其所有目录的列表。 3)要继续往下看,可单击game/文件夹。 5)若你要下载doom95.zip文件,只需在其上单击。 6)由于zip(后缩文件)Netscape不能显示或没有相应的观看程序, 这时将出现一个Unknow File Type对话框,单击Save File 按钮,此后在对话框中输入一存放位置来存储该文件,然后单击OK。
❾ windowsftp如何获取文件夹下所有的文件
可以通过命令窗口来打开所有的文件。具体步骤如下:
点击win+R后输入cmd打开dos命令窗口。
打开需获取文件名的位置。
获取名称,命令格式:dir/b文件目标盘符文件夹位置(可省略)目标名称.目标后缀。
获取文件大小及文件名、修改时间(文件大小需处理)。
Microsoft Surface是一个由微软所开发的第一款平面电脑,结合硬件与软件的新技术,用家可以直接用手或声音对屏幕作出指令,触摸和其他外在物理物来和电脑进行交互,毋须再依赖会令手部劳损的鼠标与键盘。
❿ QT编程 获取当前工作目录下的文件列表,并以Tree的形式显示在界面上
String[] s={"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
System.out.print("请输入数字(1-12):");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
int m=Integer.parseInt(str);
if (m<=0||m>=13)
{