CURL Command Line SFTP Upload - Specify Destination Filename

Steve Goddard

I'm trying to upload a file using command line Curl. Uploading a file (without renaming) works fine:

curl -1 -v -k "sftp://some.domain.com:1234" --user "username:password" -T "my_local_file.txt" 2>&1

But is it possible to specify a different destination filename? I'd like to save the file on the remote server with a different name. Is this possible?

At the moment I'm renaming the file locally; uploading it and then naming it back. Not ideal.

Thanks!

David Fox

The -T flag allows you to specify the local file, and you can specify the remote path and filename directly in the URL.

Like so:

curl -1 -v -k "sftp://some.domain.com:1234/remote_path/remote_filename" --user "username:password" -T "local_filename"

This will upload my_local_file.txt from your local system to some_folder on the remote server, the file will be savd as new_remote_file.txt and you won't have to rename the file locally before and after the upload.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

cURL with SFTP via port 22 command line not supported/enabled

How can i upload file by command line via sftp?

What is the curl command line to send this HTTP Post to Cakephp to upload a file?

Curl command to output filename with a timestamp

cURL http post file upload using curl --data in linux command line

How can I specify that curl (via command line) overwrites a file if it already exists?

AutoCAD Command Line Spaces In Filename

Image upload CURL command to PHP Curl

cURL command to upload file does not upload file

Specify dockerignore from command line

Specify antialias property in the command line

Is it possible to specify an at command on a single line?

Specify vim filetype on command line

How to upload files to different subdirectory using PHP via cURL on Linux command line?

Specify Destination Directory for 'zip' Command Output (The Zip file that is Created)

How to specify @ in username and password for curl command?

Convert multiple SFTP command lines to a single line command line

How to convert command line cURL to PHP cURL?

php cUrl to command line curl call

Curl encoding issues with command line

Convert CURL command line to VBA

CURL Command Line URL Parameters

Converting Curl command line to python

stripe curl command line POST

Unable to upload to generic repository with correct filename using curl

Looking for awk command to append filename at end of line

Windows command line FOR loop match filename begining

cURL upload photo command in NSMutableURLRequest format

Converting A javascript Http Upload script to Curl command