Welcome to Python SFTP client.
Python SFTP Client enables operate SFTP remote server. manipulate files over sftp server. copy files from remote to local path. get remote file information. manage remote files. Create directory to remote machine, Remove directory to remote machine, file listings & permission:
Installation instruction using source code
$ git clone git@github.com:cis-yogesh/Python_sftp_client.git
$ python setup.py install
Installation instruction using python pip
$ pip install python_sftp_client
quick start guideline
- import SFTP module
import sftp
- create new instance of SFTP remote server
c = sftp.Connection(host = hostname,port = port, username = username, password = password)
- get a list of files for the given path
c.listdir(path='.')
- change the current working directory on the remote
c.chdir(self, path)
- get the current working directory on the remote
c.getcwd()
- Copies a file between the remote host and the local host
c.get(remotepath, localpath = None)
- Copies a file between the local host and the remote host.
c.put(localpath, remotepath = None)
- get File size in bytes
c.get_file_size(remotepath)
- Return the File created datetime
c.get_file_created_data(remotepath)
- Open given path File and return file object
c.open(filename, mode='r', bufsize=-1)
- Re-name old name to New name also work for move file
c.rename(oldpath, newpath)
- Create New dir on given path, as given file permission
c.mkdir(path, mode=0777)
- Change the permision of path
c.chmod(path, mode)
- Remove the given path directory
c.rmdir(path)
- Remove the given file
c.remove_file(path)
- Closes the connection and cleans up
c.close()
Authors and Contributors
Yogesh Dwivedi (@cis-yogesh),sapna (@cis-sapna).
Support or Contact
Having trouble with issue ? contact yogesh.p@cisinlabs.com and we’ll help you sort it out.