Skip to content
Simple python script to retrive any new filepaths from sftp server. My first python project.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Simple python script to retrieve filepaths from SFTP server and send alert email with new filepaths. After each start of script it walks the filetree, compares it to already saved items and sends an email notification to configured email address if there are any new files. TinyDB is used to store changes locally.

This script is probably only useful to you, when you have no other access to server than SFTP, as in my case.


First of all you have to replace example configuration in configuration.ini by your setting.

from: user@foo.qiz        //From which address will be emails sent
to: target@bar.qux        //To which address will be email sent
smtp_server: //smtp server for sending emails
smtp_user: user@foo.qiz   //Your user name for smtp server
smtp_pass: password       //Your password for smtp server
host:    //SFTP server which will be checked for new files
user: user                //User at SFTP server
port: 22                  //Port of SFTP server
key_path: /home/user/.ssh/id_dsa //Path to private ssh key for authentication
start_path: /             //Path on which the script starts recursive searching

How to run



  • Python 3
  • Packages:
    • email - email composing
    • smtplib - sending email
    • pysftp - sftp related operations
    • tinydb - filepaths storage and handling
    • tinydb_serialization - object serialization for storage purposes



Due to the changes in TinyDB imports were updated to make this script working with latest TinyDB (3.11.1).

You can’t perform that action at this time.