SFTP using JSch Java

Hi Friends,

Open source API to connect Linux machine.

these custom functions was created using J-SCH.

Custom functions with examples- java,

#1.   sftp.sshcreateconnection(String server,String username,String pwd)

Description = used to create a connection

inputs ;-

server = linux machine IP address (Ex. or Hostname )
username = username
pwd = password
#2.   sftp.sshfiledownload(String remotepath,String localpath)
Description = downloading file from remote machine to local machine

inputs ;-
remotepath = remote machine file path (Ex. /user/home/sathish/test.txt)
localpath = location to store/local machine file path (Ex. D:/sathish/test.txt)


#3.   sftp.sshfileupload(String localpath,String remotepath)
Description = uploading file from local machine to remote machine

inputs ;-
remotepath = remote machine path (Ex. /user/home/sathish/)
localpath = local machine file path (Ex. D:/sathish/test.txt)


#4.   sftp.sshfiledelete(String remotepath)
Description = deleting a file from remote machine

inputs ;-
remotepath = remote machine file path (Ex. /user/home/sathish/test.txt)


#5.   sftp.sshfilerename(String oldname, String newname)
Description = Renaming a existing file from remote machine

inputs ;-
oldname = remote machine old file path (Ex. /user/home/sathish/test.txt)
newname = remote machine new file path (Ex. /user/home/sathish/testnewfile.txt)


#6.   sftp.sshcreatefolder(String remotepath)
Description = creating a new folder

remotepath = foldername (Ex /user/home/sathish/newfolder)


#7.  sftp.sshdeletefolder(String remotepath)
Description = deleting an empty folder

remotepath = foldername (Ex /user/home/sathish/newfolder)


#8.   sftp.sshlslister(String param)
Description = listing all the files from current directory

param = directory path


#9.   sftp.sshdchangedir(String remotepath)
Description = changing one directory to another directory

remotepath = new directory path


#10.   sftp.sshdircheck()
Description = Displaying current directory path


#11.   sftp.sshcloseconnection()
Description = closing the connection.

Jar File Download Link:

Download the below jars and add it into your project build path !!!!


—————————— Thanks  ————————-






Up ↑