Mermaid: A Much Underutilized Tool for Reproducible, Programmatically Updateable Diagram Documentation

Normally, an FTP client app can only upload files under one folder on the FTP site at a time. This is extremely cumbersome! This utility is used to upload an entire nested hierarchical local directory to an FTP site in one go.
Python
FTP Folder Upload
Author

Steven Wang

Published

September 9, 2022


1 Motivation

I am not sure if you have ever had same experience as me when you trying to upload a highly hierarchical nested local folder to an remote ftp site. For any FTP client I used like FileZilla, NppFTP etc It can only upload 1 or multiple files in a folder to a folder in FTP site. If a folder is not in the FTP site, then you need to create such folder first and then upload all the files to the folder. If there is a subfolder under a folder, you will be not able upload the sub-folder since only files are allowed to be uploaded. Therefore, you will need to create the sub-folder first before uploading the files into it. If you have a very deep hierarchy of folder structure, this will be really frustrating.

For a website deployment, if you don’t have a deployment tool. Then you will have to rely on the ftp upload to update your site, you can imagine this will be very cumbersome. I encountered such issue since I started to use Quarto to build my new blog. As I’m deploying the blog into my own site, there is no available tool to do this. This made me to write this python utility to do such job.

2 Python comes to Rescue!

I am lazy and I like everything just need a click if it can. I used Python for file uploading to FTP site before but not nested folders. After a quick test, I found ftppretty library in conjunction with pathlib library are the best combination for me to quickly make this work.

I therefore wrote this function and I thought it may benefit to others if you have experienced same issue.

3 Github Repo

You can get the code from the github repo if you need.