B4J Question Can't find solution for SFTP server folder delete operation


Hello everyone, I'm using JSch android library for SFTP server. Everything working well, but I need to delete empty folder on it and tried sftp1.DeleteFile ("/upload/1/"), where "1" is empty folder created by sftp1.Mkdir ("/upload/1/"), but without success and I got following message:

4: Failure
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
at com.jcraft.jsch.ChannelSftp.rm(ChannelSftp.java:1985)
at anywheresoftware.b4a.objects.SFtpWrapper$2.run(SFtpWrapper.java:189)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
delete success=false

Please advise, what am I doing wrong.


Well-Known Member
Licensed User
Please try the attached library - v1.31

It adds a Rmdir method for deletion of empty folders.
I haven't tested it.
it seems the JSch.jar is not updated.
Upvote 0


Erel, thanks for the prompt reply.

How can I use the rmdir method?
I still only have sftp1.DeleteFile in the list, and when using sftp1.DeleteFile ("/upload/1/") I get the same result as before
Upvote 0