Sample Script: TLuaSFTPClient--Demonstrates the Lua SFTP client class --Create the client object sftp = TLuaSFTPClient() --Connect to the remote SFTP server if sftp:Connect("username","password") == false then SetExitStatus("No respons",false) return
end
--Create a directory handle and open the current directory hHandle = TLuaSFTPClientDirectoryHandle() bOk = sftp:OpenDir(".",hHandle) if bOk == true then -- List the directory bOk = sftp:ListDir(hHandle) if bOk == false then SetExitStatus("Cannot list directory",false) sftp:CloseDir(hHandle) return end --Loop over the entries in the directory File = TLuaSFTPClientFile() while hHandle:Next(File) ~= false do --Print the file name print(File.m_sFilename) end
end
--Close handle sftp:CloseDir(hHandle) | |||
Topic 9731: Send Feedback. Download a PDF of this online book from the first topic in the table of contents. Print this topic. |