cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete file dynamically from FTP location

sowmya_krishna
Explorer
0 Kudos

Hi Guys,

I have scenario sending file from FTP to SFTP server, where 2 files are placed in FTP location, out of one file has to be processed to SFTP server & the other file has to deleted from FTP location without processing. Could anybody has idea, how to acheive this? do we need to use any module here , please advice.

Thanks & regards

Sowmya

Accepted Solutions (0)

Answers (4)

Answers (4)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

I can give very simple approach. Out of two files you need to delete one in the sender directory system then design this way.  Create two folders like temp and real.  Let the sender system drops both the files in temp folder.  Use OS script to just move the required file to the real folder.  Thats it.

Configure PI to process only the real directory /folder. You don't need to create extra scenario or overload the PI for this requirement.  This is my few cents.

The file that left out in the temp can be deleted or archived based on the requirement.

rajasekhar_reddy14
Active Contributor
0 Kudos

1)I would prefer deleting file using OS script and call the same in sender file channel,if you wanna archive the deleted file you can easily achive it.

or

2)Develop one more file to file scenario and schedule that interface after first interface and delete the file using new scenario and archive the file.

ambrish_mishra
Active Contributor
0 Kudos

Hi Sowmya,

Do you have an identifier to identify the file which needs to be processed and the one which needs to be deleted. If yes, You can process the file which is needed with file name mask (this should make sure the other file is not processed) and run OS command to delete the file which is not required. You can work with basis to create the script for deletion of the file.

Hope it helps!

Ambrish

Former Member
0 Kudos

Hello,

I am not sure if i understood your post correctly but it seems that you want to process your main file once trigger file with the same name is available on FTP server? If yes then there can be few options:

1) Write a script which will keep on checking for files and pick main file once trigger file is available (but certainly not a recommended approach)

2) Move files from FTP to NFS server and then follow below approach (question 4) + use payload swap bean:

http://wiki.sdn.sap.com/wiki/display/XI/Sender+File+Adapter+Frequently+Asked+Questions

Thanks

Amit Srivastava