PDA

View Full Version : RNFR/RNTO using temp file


dibblah
05-04-2012, 02:53 AM
Hi!

Is it possible to have flashfxp upload and overwrite a file in this manner?

file: clientraw.txt

flashfxp renames it clientraw.txttmp and then:

RNFR clientraw.txttmp
350 RNFR accepted - file exists, ready for destination
RNTO clientraw.txt
250 File successfully renamed or moved


ie to make sure it´s a succesful upload before overwriting exiting file, it´s for a schedule so I won´t be around to check every time that it´s succesful and didn´t just leave a 0 kb file :/

Thnx in advance and hoping someone who´s good at this stuff has an answer :)

/Dibblah

bigstar
05-04-2012, 11:06 AM
Are you seeing situations where FlashFXP is leaving a 0 kb file and not actually transferring the file, or are you just thinking ahead to avoid this type of issue in the future?

Assuming that you have FlashFXP configured to retry failed transfers and restart the transfer if stalled then this should never occur.

But if you really wanted to do something like this it could be done, however to do this is a rather advanced process.

What you would need to do is queue the file for transfer, edit the queue item properties, (right-click the queue item and select it), and then change the target name to something else, say "rfc959.txt_tmp", then click the OK button to save your changes.

Save the queue to a file, then transfer it, creating the new temporary file on the remote server.

Next you'd need to en-queue a rename operation, select the temporary file on the remote server, right-click, select EnQueue > Rename and then enter the correct name.

You should now have two entries in your queue.
1. upload the file to a temporary file name.
2. rename the temporary file to the correct name.

Save the queue file again.

Now whenever this queue runs it will upload the file and then rename it.

Some FTP servers do not allow you to rename a file if the new name already exists, in which case you would need to add a 3rd item to the queue to delete the existing file prior to the rename operation. This would be done the same way, EnQueue > Delete

The queue would then look something like this:

https://oss.azurewebsites.net/images/forum/upload_delete_rename.png

MxxCon
05-04-2012, 11:54 PM
Bigstar, but this can't be done conditionally. So if the file fails to transfer, the other 2 commands will run regardless.

bigstar
05-05-2012, 08:53 AM
There is some additional behind the scenes logic to this madness, but I will verify that this only executes on successful transfer. Of course the ideal logic would be nested command chaining.

bigstar
05-05-2012, 06:44 PM
It looks like I was wrong, in this specific situation the commands would still execute on transfer failure (since the delete command doesn't match the target name of the failed transfer) the only way to prevent this would be to have a way to chain commands based on successful transfer.

Perhaps this is something that could be added in the future if there was enough demand for it.