cancel
Showing results for 
Search instead for 
Did you mean: 

Udf delete file on ftp server before create file on channel

brian_briones
Participant
0 Kudos

Hi experts,

I need delete files on directory ftp when I go to create the new file.

My interface is proxy-》file and I think delete the files with udf on mapping.

Can you help with java code?... I look with file lookup for read but not delete...

Regards experts.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member190293
Active Contributor
0 Kudos

Hi Brians!

If you want to delete files in FTP-server directory using java you can use Apache FTP Client functionality.

Something like:

FTPClient client = new FTPClient();
client
.connect(host, port);
client
.login(loginname, password);
client
.deleteFile(fileNameOnServer);
client
.disconnect();


Regards, Evgeniy.

Former Member
0 Kudos

The query above is not so clear what you basically need. But what I understand from above is that you want to delete file in a directory before new file is created in the directory. If yes, then you can use the shell script. You can write script code and can call that from file receiver adapter (OS Command) before you finally create the file in directory. Check file adapter features and running operating system commands before and after message processing. You will have to use OS command before message processing.

brian_briones
Participant
0 Kudos

Hi,

The OS command is on NFS system ... I need on ftp server.

In this blog read file with udf java...

FILE LOOKUP IN SAP PI USING UDF | SCN

Former Member
0 Kudos

Are you sure that OS commnand cant be performed on FTP ? As I know it does exist for FTP too. Please check again and follow this link.