How to upload every file in directory to server with curl

I have a local folder called dist and I would like to upload the files in that folder to my server - but I don't want to upload the folder - only it's contents

find dist -type f -exec curl -u username@my_server.com:my_password --ftp-create-dirs -T {} ftp://ftp.my_host.com/cantorah.com/ \;

This works but it results in a dist directory on my server - and I just want the files inside that directory to be uploaded without the directory itself.

How can this be accomplished?


From the curl manpage:

--create-dirs

When used in conjunction with the -o, --output option, curl will create the necessary local directory hierarchy as needed. This option creates the >dirs mentioned with the -o, --output option, nothing else. If the --output file name uses no dir or if the >dirs it mentions already exist, no dir will be created.

Created dirs are made with mode 0750 on unix style file systems.

To create remote directories when using FTP or SFTP, try --ftp-create-dirs.

It seems like the --ftp-create-dirs parameter could lead to the unwanted behaviour of also creating a directory instead of only uploading the files.

You may consider running your above command without the --ftp-create-dirs option to achieve the wanted behavior.