ftp

作者: olfen, ahklerner, fincs 最近更新时间: 20090127


Set of functions to work with directories and files located on a FTP server.

FTP_Close()
FTP_CloseSocket(hConnect)
FTP_CreateDirectory(hConnect,DirName)
FTP_DeleteFile(hConnect,FileName)
FTP_FileTimeToStr(FileTime)
FTP_FindFirstFile(hConnect, SearchFile, ByRef @FindData)
FTP_FindNextFile(hEnum, ByRef @FindData)
FTP_GetCurrentDirectory(hConnect,ByRef DirName)
FTP_GetFile(hConnect,RemoteFile, NewFile="", Flags=0)
FTP_GetFileInfo(ByRef @FindData, InfoName)
FTP_GetFileSize(hConnect,FileName, Flags=0)
FTP_Open(Server, Port=21, Username=0, Password=0 ,Proxy="", ProxyBypass="")
FTP_PutFile(hConnect,LocalFile, NewRemoteFile="", Flags=0)
FTP_RemoveDirectory(hConnect,DirName)
FTP_RenameFile(hConnect,Existing, New)
FTP_SetCurrentDirectory(hConnect,DirName)

关于函数的参数和返回值, 请参阅其源码.

备注

It is not strictly stdlib conform, because it uses in one or more functions global variables, at least in FTP_Open().

These functions are originally created and posted by olfen at http://www.autohotkey.com/forum/viewtopic.php?p=63704#63704.

Later ahklerner changed the source and republished at http://www.autohotkey.com/forum/viewtopic.php?p=170587#170587.

Some time later, fincs added a function FTP_GetCurrentDirectory() to the library. And now, I have added a prefix FTP_ to the function FileTimeToStr().

This is the result. Date is from last added function of fincs.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?p=170587#170587

许可

不存在

示例

; #Include ftp.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

; General settings
server = www.autohotkey.net
port = 21
username = 0
password = 0

file_to_upload = %A_ScriptName%
file_remote_path = %A_ScriptName%

file_to_download = lib/path.ahk
file_local_path = path.ahk

; Start the processes
GoSub, Upload
GoSub, Download
Return

Upload:
hConnect:=FTP_Open(Server, Port, Username, Password)
FTP_PutFile(hConnect,file_to_upload, file_remote_path)
FTP_CloseSocket(hConnect)
FTP_Close()
MsgBox Upload completed.
Return

Download:
NewFile = path.ahk
RemoteFile = lib/path.ahk
hConnect:=FTP_Open(Server, Port, Username, Password)
FTP_GetFile(hConnect,file_to_download, file_local_path)
FTP_CloseSocket(hConnect)
FTP_Close()
MsgBox Download completed.
Return