cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Renaming files via SFTP connection

From: Doug McNutt <douglist_at_macnauchtan.com>
Date: Fri, 14 Jan 2011 12:37:32 -0700

At 13:05 -0500 1/14/11, balsamik1 wrote:
>Sorry, I did not realize before that Curl is just a primitive tool supported by
>a bunch of touchy amateurs, and that I should simply be happy that it works at
>all.
>Thanks for straightening that out!

Curl is a UNIX tool. An impressive one that has been ported widely.

So is ftp, ssh, and sftp which is really part of ssh.

The ftp protocol does not support protection for overwrite. Neither does cp or rcp. The UNIX philosophy is to keep things simple with tools doing one thing well and not being aggressive. I, personally, like it that way and I am not alone.

On your remote machine, assuming you have some decent access, you could turn off write permission for files you work with. That way curl's ftp would fail if you tried to overwrite without first renaming or deleting the older file. You could also make a backup copy of files as you load them up with the backup having a generated name that includes a simple date. I use _YYMMDD_ so they sort properly.

If you really want your software to be foolproof there are many GUI-based clients that can do what you want, like putting a -1 or the like after the name of a file when it is uploaded and another copy exists. I have no idea how you would automate conversions of other, perhaps HTML, files that would need to be changed to point to the newer copy with a different name.

If you have ssh access to the distant server you can send commands to be executed there. It would be pretty easy to do a rename that way. You could also move old files to a subdirectory, Archive zB.

>X-Mailer: Microsoft Office Outlook 11

I note that you're using a Windows box. Perhaps you should consider complaining to Microsoft.

-- 
-->  The best programming tool is a soldering iron <--
-------------------------------------------------------------------
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