cancel
Showing results for 
Search instead for 
Did you mean: 

Rename and move files on remote FTP server

shweta_walaskar2
Contributor
0 Kudos

Hello,

We have a scenario where XI transfers a file to a remote FTP server at partner end using File Receiver Communication channel.

These files are huge,so there is a risk of picking up incomplete files at their end when XI is still writing the file on their server.

Hence,we have decided to follow the approach which is already mentioned a number of times on SDN that XI would place a file with different name and in a different folder on partner's FTP server.

This would then be renamed and moved to the required folder on the same server.

This could easily be managed using a script at partner end but there are some problems when they are not able to do this.

Is there a possibility to achieve this using 'Run OS command after Message Processing' in XI when Source and target folders both are on partner's FTP server?

If yes,can anybody please provide code for such a script and corresponding setting for this parameter in XI Communication channel?

Thanks a lot in advance.

Best Regards,

Shweta

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Shweta,

To answer your query, follow these steps:

1. You can write a .bat/.sh (batch file or a script file) and call the same batch file from the Communication channel configuration. Run OS command after message processing. Remember to give the relative file of the batch command. eg. E:\file\command.bat

2. In the batch file, you may write two lines of command which will first rename the file to the target file that you want and then move (cut/paste) the file to the final target location that you want the file to be copied on the ftp server. For eg. the contents of the command.bat file can be:

rename <relative_path_of_source_file> <relative_path_of_target_file>

move <relative_patch_of_source_file_location> <relative_patch_of_target_file_location>

eg:

rename source.txt target.txt

move c:\target.txt d:\target.txt

Hope this helps .

Regards, Gaurav.

shweta_walaskar2
Contributor
0 Kudos

Hello,

Thanks for the reply.

But this has to be done in FTP session because the source and target directory both are on remote FTP server.

Instead,in SAP documentation,I found a parameter :

ftp.putSafe=YES|NO

Use this specification to define whether a transferred file is first created with a temporary name and only renamed once the transfer is complete (YES), or whether it is created with its final name at the start of the transfer (NO). The latter case can lead to problems if an application on the FTP server accesses the file before the transfer is complete. If you specify YES, this problem is avoided because the file only becomes visible with the search name when the transfer is complete.

The default value is NO.

Doesn't it serve the same purpose?Do we still need to write scripts?

I have tried to include this in Additional Parameters in Advanced Mode as:

ftp.putSafe YES

but I can't check in test system whether it is really working or not.I would like to confirm if it helps.

First of all,I would like to know if this setting works for XI3.0 SP17.

Can anyone please help.

Thanks.

Regards,

Shweta

shweta_walaskar2
Contributor
0 Kudos

Hello,

These are the entries I see in CPA Cache:

<Attribute xmlns=""><Name>file.addParameterParams</Name><Value isTable="true"><Row><Field><Fieldname>file.addParameterParamName</Fieldname><Fieldvalue>ftp.putSafe</Fieldvalue></Field><Field><Fieldname>file.addParameterParamValue</Fieldname><Fieldvalue>YES</Fieldvalue></Field></Row></Value></Attribute>

<Attribute xmlns=""><Name>ftp.putSafe</Name><Value dataType="xsd:string">NO</Value></Attribute>

So I believe,it is not working.

What should I do to make it:

<Attribute xmlns=""><Name>ftp.putSafe</Name><Value dataType="xsd:string">YES</Value></Attribute>

Kindly help.

Thanks.

Regards,

Shweta

Answers (1)

Answers (1)

shweta_walaskar2
Contributor
0 Kudos

Hello,

This parameter is automatically set to YES when we select 'Use Temporary File' in Put File.

Thanks.

Regards,

Shweta