Table of contents

Upload directory over FTP

FTP does not include a command to transfer a directory only files. This is a problem if you want to create a script, that automatically uploads a directory to an FTP server.

The Solution

The tool ncftp includes the ncftpput command, that makes it possible to transfer a directory in one command:

ncftpput -R -v -u USER HOST HOST-PATH LOCAL-PATH

For uploading the public folder of my hugo site i created this script:

#!/bin/bash
HOST="balderholst.com"
USER="user@balderholst.com"

ncftpput -R -v -u "$USER" "$HOST" "/public_html" public/*