當前位置:首頁 » 文件傳輸 » ftp獲取指定文檔
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

ftp獲取指定文檔

發布時間: 2023-03-06 10:38:37

『壹』 怎麼用ftp 取文件 命令

熟悉並靈應用FTP內部命令便使用者並收事半功倍效
FTP命令行格式:ftp -v -d -i -n -g [主機名]其
-v顯示遠程伺服器所響應信息;
-n限制ftp自登錄即使用;
.n etrc文件;
-d使用調試式;
-g取消全局文件名
ftp使用內部命令(括弧表示選項):
1.![cmd[args]]:本機執行交互shellexitftp環境:!ls*.zip.
2.$ macro-ame[args]:執行宏定義macro-name.
3.account[password]:提供登錄遠程系統功訪問系統資源所需補充口令
4.append local-file[remote-file]:本文件追加遠程系統主機若未指定遠程系統文件名則使用本文件名
5.ascii:使用ascii類型傳輸式
6.bell:每命令執行完畢計算機響鈴
7.bin:使用二進制文件傳輸式
8.bye:退ftp程
9.case:使用mget遠程主機文件名寫轉寫字母
10.cd remote-dir:進入遠程主機目錄
11.cp:進入遠程主機目錄父目錄
12.chmod mode file-name:遠程主機文件file-name存取式設置mode:chmod 777 a.out
13.close:斷與遠程伺服器ftp(與open應)
14.cr:使用asscii式傳輸文件車換行轉換行

『貳』 windowsftp如何獲取文件夾下所有的文件

可以通過命令窗口來打開所有的文件。具體步驟如下:
點擊win+R後輸入cmd打開dos命令窗口。
打開需獲取文件名的位置。
獲取名稱,命令格式:dir/b文件目標盤符文件夾位置(可省略)目標名稱.目標後綴。
獲取文件大小及文件名、修改時間(文件大小需處理)。
Microsoft Surface是一個由微軟所開發的第一款平面電腦,結合硬體與軟體的新技術,用家可以直接用手或聲音對屏幕作出指令,觸摸和其他外在物理物來和電腦進行交互,毋須再依賴會令手部勞損的滑鼠與鍵盤。

『叄』 如何使用bat命令直接下載指定ftp上面的指定文件

ftp下載文件一般步驟如下:
echo open xxx.xxx.xxx.xxx >ftp.txt
echo user >>ftp.txt
echo password >>ftp.txt
echo binary >>ftp.txt [可選]
echo get srv.exe >>ftp.txt
echo bye >>ftp.txt
ftp -s:ftp.txt(這一步是關鍵喲)
del ftp.txt
存為*.bat

『肆』 c++如何讀取ftp上指定的文件

#include<fstream>
using namespace std;

ifstream cin(""/*ftp地址*/);

int main()
{
int a;

cin>>a;

cin.close();

return 0;
}

『伍』 如何在ftp中搜索指定文件

可以用asp的fso組件(也就是FileSystemObject)對文件進行搜索

『陸』 python ftp連接指定伺服器,並下載指定文件

ftp客戶端一般只有顯示、上傳、下載,並沒有打開文件的操作,所以你得先下載相應配置文件,在本地解析後,再繼續用相關參數下載後續文件。

『柒』 如何設置指定用戶名通過ftp訪問指定共享文件

Linux添加FTP用戶並設置許可權在linux中添加ftp用戶,並設置相應的許可權,操作步驟如下:1、環境:ftp為vsftp。被限制用戶名為test。被限制路徑為/home/test2、建用戶:在root用戶下:useradd-d/home/testtest//增加用戶test,並制定test用戶的主目錄為/home/testpasswdtest//為test設置密碼3、更改用戶相應的許可權設置:usermod-s/sbin/nologintest//限定用戶test不能telnet,只能ftpusermod-s/sbin/bashtest//用戶test恢復正常usermod-d/testtest//更改用戶test的主目錄為/test4、限制用戶只能訪問/home/test,不能訪問其他路徑修改/etc/vsftpd/vsftpd.conf如下:chroot_list_enable=YES//限制訪問自身目錄#(defaultfollows)chroot_list_file=/etc/vsftpd/vsftpd.chroot_list編輯vsftpd.chroot_list文件,將受限制的用戶添加進去,每個用戶名一行改完配置文件,不要忘記重啟vsFTPd伺服器[root@linuxsir001root]#/etc/init.d/vsftpdrestart5、如果需要允許用戶修改密碼,但是又沒有telnet登錄系統的許可權:usermod-s/usr/bin/passwdtest//用戶telnet後將直接進入改密界面

『捌』 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伺服器下指定文件的大小

//////獲取ftp伺服器上指定文件夾的文件列表(包含文件大小)//////////////////publicDictionaryGetFTPList(stringServerIP,stringUSERID,stringPassWord,stringpath){Dictionarydic=newDictionary();if(path==null)path="";FtpWebRequestreqFtp;try{reqFtp=(FtpWebRequest)FtpWebRequest.Create(newUri("ftp://"+ServerIP+"/"+path));reqFtp.KeepAlive=false;reqFtp.UseBinary=true;//指定ftp數據傳輸類型為二進制reqFtp.Credentials=newNetworkCredential(USERID,PassWord);//設置於ftp通訊的憑據reqFtp.Method=WebRequestMethods.Ftp.ListDirectoryDetails;//指定操作方式WebResponseresponse=reqFtp.GetResponse();//獲取一個FTP響應StreamReaderreader=newStreamReader(response.GetResponseStream(),Encoding.GetEncoding("GB2312"));//讀取響應流stringline=reader.ReadLine();while(line!=null){if(line!="."&&line!=".."){intend=line.LastIndexOf('');intstart=line.IndexOf("");stringfilename=line.Substring(end+1);if(filename.Contains(".")){line=line.Replace(filename,"");dic.Add(filename.Trim(),int.Parse(line.Substring(start).Trim()));}}line=reader.ReadLine();}}catch(Exceptionex){Console.WriteLine(ex.Message);}returndic;}文件夾或者某一文件都適用