Create Folder in Remote FTP Server with cURL command

We can use cURL command to create new directories in a remote FTP Server. To create a new folder we need to send MKD (standard ftp command to make directory) command to the FTP server.

To send commands to the FTP server, we use -Q / –quote option.

curl -u user:123456 ftp://ftp-server -Q "MKD directory_name"


In the following example, we create a new folder called “dir1” in the FTP Server at

curl -u user:123456 -Q "MKD dir1"

–ftp-create-dirs option

The –ftp-create-dirs option of the curl command use to create missing directories while uploading files.

For example, following command will upload “file.txt” to the “documents” folder. If the “documents” folder doesn’t currently exist on the server, curl command will create the directory.

curl -u user:123456 --ftp-create-dirs -T file.txt