cURL / Mailing Lists / curl-users / Single Mail

curl-users

Renaming files via SFTP connection

From: balsamik1 <balsamik1_at_gazeta.pl>
Date: Thu, 13 Jan 2011 18:56:06 -0500

Hi,

I am trying to use CURL to first send a file over SFTP connection, and later
separately rename that file using a new or the same SFTP connection.
Sending works perfectly fine but I am having problem with the renaming. So far
the only way it works is when I use complete absolute paths preceding each of
the filenames listed in in the -Q 'rename' command.

Working example:

curl -u user:pass sftp://host.domain.com -Q 'rename /home/user/mydir/file1
/home/user/mydir/file2'

While the above works its format can make the command very difficult to read
when dealing with long absolute pathnames
and I would love to be able to shorten the command to use relative paths.

So fat i tried the following but none worked:

curl -u user:pass sftp://host.domain.com/~/mydir -Q 'rename file1 file2'
curl -u user:pass sftp://host.domain.com/~/mydir -Q 'rename ./file1 ./file2'
curl -u user:pass sftp://host.domain.com/ -Q 'rename /~/mydir/file1
/~/mydir/file2'
curl -u user:pass sftp://host.domain.com/ -Q 'rename ~/mydir/file1
~/mydir/file2'

Can you tell me if there is a way to rename files over SFTP using relative
paths?

Thanks,

Tomasz

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-14