EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP rename script command

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
Posted: 02/17/2012 07:53:05
by Gary Daly (Priority Standard support level)
Joined: 02/17/2012
Posts: 4


I am working on a project where we are planning on using the Eldo SFTP adapter. There is a requirment to copy the incoming file to an archive folder AFTER it has been read in by BizTalk.

It seems as if the On After Transfer command would allow me to achieve this. However it is not clear what syntax the command script should have in order to be able to rename/copy the file to a new directory. Could you provide a command script that would be able to achieve this functionality?

Is the On After Transfer command executed before or after the Delete Mode action (if it is specified).

Many Thanks,

Posted: 02/17/2012 15:05:20
by Ken Ivanov (EldoS Corp.)

Thank you for your interest in our products.

I am afraid you can't do that with current BizCrypto version. On After Transfer won't do the job, as it is only invoked once per session (even though a number of files could be downloaded).

There are good news though - we are releasing BizCrypto 9.1.215 update in a few days, and the updated version will contain a number of improvements with regard to command scripts and On* properties. In particular, On Before Receive and On After Receive properties will be introduced. The properties will allow to specify command scripts to be executed before and after downloading every particular file; besides, the properties will support %macro%s. You will be able to archive files with ease with the updated version.
Posted: 02/20/2012 06:56:05
by Ken Ivanov (EldoS Corp.)

JFYI: BizCrypto 9.1.215 is available for download (here).

To make the adapter archive files after download, please configure the adapter in the following way:

1. Set Safe Download Mode to After Get,
2. Set Safe Download Name to /archiving/path/%SourceFileName% (the exact path may differ depending on the configuration of the server).
Posted: 02/21/2012 03:29:24
by Gary Daly (Priority Standard support level)
Joined: 02/17/2012
Posts: 4

Hi Innokentiy,

Thanks for reply, I was out of the office yesterday so only had a chance to test the new functionality this morning. I installed the new version (9.1.215) but I couldn't get it to work correctly.

The after get command was correctly renaming the file to the file specified in the Safe Download Name field. However there is an error processing the incoming file within BizTalk:

[21-2-2012 09:58:36.472] EldoS SFTP Adapter (receive): CreateMessage()
[21-2-2012 09:58:36.487] EldoS SFTP Adapter (receive): CreateMessage(): Failed to open file: 'C:\Users\biztalk_host_acc\AppData\Local\Temp\testfile_4.csv.archive', Could not find file 'C:\Users\biztalk_host_acc\AppData\Local\Temp\testfile_4.csv.archive'.
[21-2-2012 09:58:36.487] EldoS SFTP Adapter (receive): PickupFilesAndSubmit(): No files to submit.

Within BizTalk itself there is no suspended message and no error in the event log. It is only in the trace log that I can see the error. I have included the full log in the attachment. It contains 2 tests

1. A test with the new Safe Download Mode set to After Get and Delete Mode set to Never, this test contains the error above.

2. Then and a successful test with the Safe Download Mode set to None and Delete Mode set to On Success.

Kind Regards,


[ Download ]
Posted: 02/21/2012 04:36:37
by Ken Ivanov (EldoS Corp.)

Thank you for the details.

Could you please check whether older BizCrypto assemblies are not accidentally loaded? After Get mode used to expose a similar issue a few builds ago, but it should have been definitely fixed in 9.1.215.

As an alternative solution, you can use a command script that would rename the file for you. Please assign the below script to the On After Receive property to have the file archived:
  <command type="sftp" value="renamefile" srcfile="/path/to/source/file" destfile="/path/to/archived/file" />

You can use macros in the script, for example:

  <command type="sftp" value="renamefile" srcfile="/files/%SourceFileName%" destfile="/archived/%SourceFileName%" />
Posted: 02/21/2012 05:21:05
by Gary Daly (Priority Standard support level)
Joined: 02/17/2012
Posts: 4

Hi Innokentiy,

I checked and the BizTalk host instance is definitely loading the new DLLs(9.1.215), see attached screenshot.

I also tried your suggestion concerning the commandscript. I am afraid this didn't work either.

You mentioed the On After Receive property in your comment but I assumed this was a typo as I only have an On After Transfer property. I tried using the
rename commandscript but it doesn't seem to be able to find the file to rename. I have the DeleteMode set to Never duringt he test so the file was still available on the server.

Below is an extract from the log file.

Kind Regards,


[21-2-2012 12:06:52.008] EldoS SFTP Adapter: SFTP connection started
[21-2-2012 12:06:52.040] EldoS SFTP Adapter: Downloading files...
[21-2-2012 12:06:57.337] EldoS SFTP Adapter: Obtained file list for /home/myusername/filedrop/in/ and mask *.csv (1 items):
[21-2-2012 12:06:57.337] EldoS SFTP Adapter: - testfile_10.csv (f)
[21-2-2012 12:06:57.353] EldoS SFTP Adapter: Downloading file testfile_10.csv from /home/myusername/filedrop/in/testfile_10.csv
[21-2-2012 12:07:02.915] EldoS SFTP Adapter: Optionally deleting remote files according to adapter settings
[21-2-2012 12:07:02.915] EldoS SFTP Adapter: Download done
[21-2-2012 12:07:02.915] EldoS SFTP Adapter: Download done, 1 files processed
[21-2-2012 12:07:02.931] Running command: renamefile(/home/myusername/filedrop/in/%SourceFileName%, /home/myusername/filedrop/archive/%SourceFileName%.copy)
[21-2-2012 12:07:04.197] EldoS SFTP Adapter: Error: 'No such file' when executing command 'renamefile'
[21-2-2012 12:07:04.197] EldoS SFTP Adapter: Closing the connection
[21-2-2012 12:07:04.212] EldoS SFTP Adapter (receive): PickupFilesAndSubmit() downloaded 1 file(s).
[21-2-2012 12:07:04.212] EldoS SFTP Adapter (receive): CreateMessage()
[21-2-2012 12:07:04.228] EldoS SFTP Adapter (receive): PickupFilesAndSubmit(): message created! PartContentType: , PartCharset:
[21-2-2012 12:07:04.244] EldoS SFTP Adapter (receive): PickupFilesAndSubmit(): Submitting 1 file(s).
[21-2-2012 12:07:04.244] EldoS SFTP Adapter (receive): SubmitFiles(): Submitting a batch of 1 file(s).
[21-2-2012 12:07:04.525] SFTPReceiverEndpoint::BatchInfo::OnBatchComplete() overallStatus = True
[21-2-2012 12:07:04.540] SFTPReceiverEndpoint::BatchInfo::OnBatchComplete() Closing temporary stream
[21-2-2012 12:07:04.540] SFTPReceiverEndpoint::BatchInfo::OnBatchComplete() Deleting local file: testfile_10.csv
[21-2-2012 12:07:26.714] EldoS SFTP Adapter (receive): Removing receiver endpoint.
[21-2-2012 12:07:26.714] EldoS SFTP Adapter (receive): Stop()

Posted: 02/21/2012 05:33:40
by Ken Ivanov (EldoS Corp.)

You mentioed the On After Receive property in your comment but I assumed this was a typo as I only have an On After Transfer property.

Hmm, that is really strange. All symptoms (in particular, the absence of On After Receive property) only confirm that you are running an older version. It can be that you have two different BizCrypto versions installed, and BTSNTSVC loads both of them, causing version conflicts. Please try to completely uninstall all existing BizCrypto installations and then install version 9.1.215 from scratch.

Just to be absolutely sure, I've reinstalled version 9.1.215 locally and checked both the workability of After Get mode and the presence of On After Receive property.
Posted: 02/21/2012 06:23:23
by Gary Daly (Priority Standard support level)
Joined: 02/17/2012
Posts: 4

Hi Innokentiy,

I got the On After Receive command script working now :-)

I forgot to restart the BizTalk Server Administration Console after I installed the new version of the BizCrypto. While the BizTalk Host Instances were loading the correct DLLs the Administration Console still had the old version loaded. I didn't need to un-install and re-install BizCrypto a simple restart of the Administration console solved the On After Receive issue.

I tried the Safe Download Mode again but I couldn't get it to work. However this isn't important to me now that the On After Receive provides the functionality I require.

Thanks for your help,


Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.



Topic viewed 5153 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!