Asyncftpclient: adding removeDir proc

This commit is contained in:
pyloor
2016-09-21 23:58:07 +02:00
parent 723bc158ce
commit bc19b71fd2

View File

@@ -354,6 +354,10 @@ proc store*(ftp: AsyncFtpClient, file, dest: string,
await doUpload(ftp, destFile, onProgressChanged)
proc removeDir*(ftp: AsyncFtpClient, dir: string) {.async.} =
## Delete a directory ``dir`` on the remote FTP server
assertReply(await ftp.send("RMD " & dir), "250")
proc newAsyncFtpClient*(address: string, port = Port(21),
user, pass = ""): AsyncFtpClient =
## Creates a new ``AsyncFtpClient`` object.
@@ -373,6 +377,8 @@ when not defined(testing) and isMainModule:
echo await ftp.listDirs()
await ftp.store("payload.jpg", "payload.jpg")
await ftp.retrFile("payload.jpg", "payload2.jpg")
await ftp.createDir("deleteme")
await ftp.removeDir("deleteme")
echo("Finished")
waitFor main(ftp)