Skip to content

jNizM/Class_FTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Class_FTP

AutoHotkey wrapper for FTP Sessions (msdn-docs)

Examples

Writes a file to the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
FTP.PutFile(hSession, "C:\Temp\testfile.txt", "testfile.txt")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Retrieves a file from the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
FTP.GetFile(hSession, "testfile.txt", "C:\Temp\testfile.txt")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Retrieves the file size of the requested FTP resource.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
MsgBox % FTP.GetFileSize(hSession, "testfile.txt")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Deletes a file from the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
FTP.DeleteFile(hSession, "testfile.txt")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Creates a new directory on the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
FTP.CreateDirectory(hSession, "Test_Folder")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Changes the client's current directory on the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
FTP.SetCurrentDirectory(hSession, "Test_Folder")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Returns the client's current directory on the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
MsgBox % FTP.GetCurrentDirectory(hSession)
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Deletes a directory on the server.

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
FTP.RemoveDirectory(hSession, "Test_Folder")
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Enumerate all Files in root directory. (!!! EXPERIMENTAL !!!)

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
for k, File in FTP.FindFiles(hSession)
	MsgBox % File.FileName
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Enumerate all Files in a subdirectory. (!!! EXPERIMENTAL !!!)

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
for k, File in FTP.FindFiles(hSession, "/Folder 2")
	MsgBox % File.FileName
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Enumerate all Folders in root directory. (!!! EXPERIMENTAL !!!)

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
for k, Folder in FTP.FindFolders(hSession)
	MsgBox % Folder.FileName
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Enumerate all Folders in a subdirectory. (!!! EXPERIMENTAL !!!)

hFTP := FTP.Open("AHK-FTP")
hSession := FTP.Connect(hFTP, "ftp.example.com", 21, "user", "passwd")
for k, Folder in FTP.FindFolders(hSession, "/Folder 2")
	MsgBox % Folder.FileName
FTP.Disconnect(hSession)
FTP.Close(hFTP)

Questions / Bugs / Issues

Report any bugs or issues on the AHK Thread. Same for any questions.

Copyright and License

The Unlicense

Donations (PayPal)

Donations are appreciated if I could help you

About

AutoHotkey wrapper for FTP Sessions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published