Deleted Files

Bob Sneidar bobs at twft.com
Wed Jun 2 17:30:06 CDT 2010


Sorry Dan I missed the remote aspect of things. I was thinking you were on a local area network using a file share. 

I believe there are FTP commands to rename files. I'm not certain though. Assuming you can, it is doubtful an FTP server would allow the first file rename but not the second, should the new write fail. Also, doesn't the FTP server respond if there is an error with the command? I mean, you can never completely guarantee a remote site will still be there a split second later, but I think it would go more like this (pseudo wise):

open connection
check result 
if ok, see if file exists with same name as the one you are going to write
if it does, rename the old file
check the result
if ok, write new file
check the result
if ok, delete renamed file
if error anywhere either reconnect and try again, or bail out. 

At least you will have the renamed file sitting there in the odd circumstance that there was a disconnect. You can have a repeat loop that tries x number of times, that exits if everything works or the counter gets to x. And you would be able to tell if your SEND command was actually failing, because you would have a renamed file, but no new file. 

Bob


On Jun 2, 2010, at 3:08 PM, Dan Friedman wrote:

> Bob,
> 
> I am using the "put" because I am writing to a ftp web server.   So I need to pass a username and password.
> 
> How would I rename the file on a remote server?  Also, how would you suggest I go about this?  I could end up in a endless error check...
> 
> rename the original file
> write the data
> if error then
>  rename the original file back
>  if error then
>    then what?
> 
> What do you think?
> 
> -Dan




More information about the use-livecode mailing list