cancel
Showing results for 
Search instead for 
Did you mean: 

Rename file in sender FTP

Former Member
0 Kudos

Hi,

I have a file to file scenario which is picking files from different path of a FTP.

My requirement is to rename the file in the corresponding folder of the FTP .

e.g :

PI is picking files from the following paths of FTP

/ABC/TEST/TR_abc.xml

/DEF/TEST/SA_qwe.xml

after picking files from this path it should be like that -

/ABC/TEST/Processed_TR_abc.xml

/DEF/TEST/Processed_SA_qwe.xml

Is there any technique to do this without writing a shell script.

Thanks,

Apu

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Apu,

I have a file to file scenario which is picking files from different path of a FTP.

You can easily pick multiple files from different locations using 'Advance Selection for Source file' option in the sender File adapter.

My requirement is to rename the file in the corresponding folder of the FTP

There are numerous ways to rename a file.

1) Activate the ASMA (Adapter Specific message attribute) in your sender file adapter and check the File Name option. You will get the File name in the msg payload.

Now use Dynamic Configuration (using UDF or Module) to change the name of the file at runtime as per your requirement. You can find numerous blogs on Dynamic Configuration

2) You can use OS command in the Receiver File adapter to change the filename.

Thanks

Partha

zameerf
Contributor
0 Kudos

Hi Apu,

If your requirement is just to know that the file was already processed, you can set the archive option in sender channel, the archived file name will have a time stamp added along with original file name.

Regards,

Zameer

Former Member
0 Kudos

Dear Zameer,

I can use the archive option and provide there the path where from I am picking the file and it will rename it with the time stamp.

But the problem is that I am picking file from different path of a ftp using a single communication channel .

If I archive I will be allowed to provide a common path for the different files of different locations , but my requirement is to rename the file in different locations.

Thanks,

Apu

ambrish_mishra
Active Contributor
0 Kudos

hi Apu,

There is no standard way to rename the file if you are looking at something available in file adapter.

you can try Run OS command after message processing and rename the file there.

cheers,

Ambrish

former_member190624
Active Contributor
0 Kudos

Hello Apu,

For picking files from two different locations , use file masking in sender FTP communication channel.

Regarding renaming file as /ABC/TEST/Processed_TR_abc.xml and /DEF/TEST/Processed_SA_qwe.xml , use dynamic configuration(UDF in Message mapping) or use Adapter module.Dynamic configuration (UDF in message mapping ) is the easiest way to achieve this .

Regards

Hari.

Former Member
0 Kudos

Dear Hari,

I need to change the file name in the source ftp means in the path where from I am picking the file, not in the target path.

Thanks,

Apu