cancel
Showing results for 
Search instead for 
Did you mean: 

Script Execution in File Adapter

0 Kudos

Hi,

I have the following scenario,

There are two FTP folders(say FTP_SingleFile and FTP_MultipleFiles).

At any point of time, there would be only one file in FTP_SingleFile and n number of files in FTP_MultipleFiles.

A sender communication channel picks the file from FTP_SingleFile and pushes the file to a BPM.

Once my BPM receives this file from FTP_SingleFile, all the files in FTP_MultipleFiles need to renamed from *.tab to *.txt extension.

I am just thinking if this can be achieved by the operating system command before/after Message processing. I have never tried this though. I would appreciate if someone could guide me through this.

Thanks,

Senthil

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Operating system command might not be usefull here as you are connecting to remote FTP.

For the File Adapter transport protocol "FTP", the operating system command is NOT executed on the FTP server, but on the server hosting the Adapter Engine.

0 Kudos

Thanks for your reply.So is there any other way to resolve this issue ?

Former Member
0 Kudos

Hi Senthilnathan,

Just an option to consider:

- construct a new bat file in PI local system. This file should include ftp commands like " ftp FTP_Multiplefile.... user ... pass... REN x y... ". It will do renaming issues when triggered. Then while transferring the file from FTP_Singlefille to BPM send it also to a new receiver, Local_RCV. Local_RCV is PI local host. You will do a dummy file(FTP_singlefile) to file (NFS) scenario just to trigger the bat file using "run OS command after message processing "...

I did not try this before but therotically it should work..

Regards,

-Tarik

0 Kudos

Hi Tarik,

Thanks for your reply.In fact, even I was thinking of a similar solution.But I was looking to "run OS command after message processing ", once the FTP_Singlefille Sender communication channel is activated.

Could you pls explain if there is a need for a second receiver?

Thanks for all your help.

Former Member
0 Kudos

Hi,

Actually you are right, it should also work since even if it is FTP type OS command will run on PI host machine where the adapter engine and our bat file is on. However If you do it like I say you will have the advantage of checking file content during mapping. You may or may not trigger the bat execution acording to file content if you care about it..

Regards,

0 Kudos

Hi Tarik,

Thanks for your help.

Also, since I have never created any script, I would appreciate if you could give me some online materials link.

Former Member
0 Kudos

Hi,

You can find a lot of online sources for script examples, just google it.. In your case, I think, you should use something like;

rename.bat file:

ftp -i -s:C:\batch2.bat

batch2.bat file:

open XXX.XX.XXX.XXX

testuser

testPass

cd /TESTMAIN

cd TESTRENAME/

rename test.txt test222.txt

bye

trigger the rename.bat file from OS command and it will rename test.txt file in folder ftproot>TESTMAIN/TESTRENAME to test222.txt

best luck!

0 Kudos

Hi Tarik,

Thanks for the reply.

However, my requirement is to rename all the files in the given folder..and I wouldnt be knowing the file names.

I am under an assumption that batch files cannot be exexuted on a FTP location to change the file extensions of all files in the given directory.

Or in other words rename *.tab *.txt

would not work on a FTP location.

Pls correct me if i am wrong.

Answers (0)