FTP基本操作類大全,外加c 基礎公共幫助類

2022-01-13 08:26:22 字數 3256 閱讀 1547

///

///連線ftp伺服器

///

///ftp連線位址

///指定ftp連線成功後的當前目錄, 如果不指定即預設為根目錄

///使用者名稱

///密碼

public ftphelper(string ftpserverip, string ftpremotepath, string ftpuserid, string

ftppassword)

2、上傳

///

///上傳

///

public

void upload(string

filename)

strm.close();

fs.close();

}catch

(exception ex)

}

///

///

///

public

void download(string filepath, string

filename)

ftpstream.close();

outputstream.close();

response.close();

}catch

(exception ex)

}

4、刪除檔案

///

///刪除檔案

///

public

void delete(string

filename)

catch

(exception ex)

}

5、獲取當前目錄下明細(包含檔案和資料夾)

///

///獲取當前目錄下明細(包含檔案和資料夾)

///

public

string

getfilesdetaillist()

result.remove(result.tostring().lastindexof("\n

"), 1

); reader.close();

response.close();

return result.tostring().split('\n'

); }

catch

(exception ex)

}

6、獲取ftp檔案列表(包括資料夾)

///

///獲取ftp檔案列表(包括資料夾)

///

private

string getalllist(string

url)}}

}catch

(exception ex)

return

list.toarray();

}

7、獲取當前目錄下檔案列表(不包括資料夾)

///

///獲取當前目錄下檔案列表(不包括資料夾)

///

public

string getfilelist(string

url)

line =reader.readline();

}result.remove(result.tostring().lastindexof('\n

'), 1

); reader.close();

response.close();

}catch

(exception ex)

return result.tostring().split('\n'

); }

8、判斷當前目錄下指定的檔案是否存在

///

///判斷當前目錄下指定的檔案是否存在

///

///遠端檔名

public

bool fileexist(string

remotefilename)

}return

false

; }

9、建立資料夾

///

///建立資料夾

///

public

void makedir(string

dirname)

catch

(exception ex)

}

10、獲取指定檔案大小

///

///獲取指定檔案大小

///

public

long getfilesize(string

filename)

catch

(exception ex)

return

filesize;

}

11、更改檔名

///

///更改檔名

///

public

void rename(string currentfilename, string

newfilename)

catch

(exception ex)

}

12、移動檔案

///

///移動檔案

///

public

void moviefile(string currentfilename, string

newdirectory)

13、切換當前目錄

///

///切換當前目錄

///

///true:絕對路徑 false:相對路徑

public

void gotodirectory(string directoryname, bool

isroot)

else

ftpuri = "

ftp://

" + ftpserverip + "

/" + ftpremotepath + "/"

; }

另外就是我總結收集的比較全面的c#幫助類,不斷完善收集中... 

C 工具類 FTP操作封裝類FTPHelper

c ftphelper實現ftp伺服器檔案讀寫操作,支援ssl協議 ftp伺服器為 serv u10.0 using system using system.collections.generic using system.io using system.linq using system.net ...

C 基本操作 模版類

連續的上機課,但這次的題目真的不難 關於模版類,一天就寫好了 中位數給出乙個整數向量,有乙個長度為k的滑動視窗自左向右在該向量上滑動,每次向右移動乙個數字,計算當前視窗中數字的中位數 輸入 1,9,2,3,1 k 3 輸出 9,2,3 include include using namespace ...

類實現 單鏈表基本操作 C

節點 應包括資料值 data 以及指向下乙個節點的指標 next。include using namespace std typedef int datatype 自定義資料型別 class node node void setdata datatype tempdata datatype getd...