Nirav Patel
Nirav Patel

Reputation: 1304

How to delete remote file using Kettle Pentaho

I have a directory in remote Linux machine where files are being archived and kept for a certain period of time. I want to delete a file from remote (Linux) machine using kettle transformation based on some condition. If file does not exists then job should not throw any error but if file exists at remote location, then job should delete file or raise an error in case some other reason, i.e., permission issue. Here, the file name will be retrieved as a variable from previous steps of transformation and directory path of archived files will be fixed one.

How can I achieve this in Pentaho Kettle transformation?

Upvotes: 0

Views: 1017

Answers (2)

simar
simar

Reputation: 1822

Or you can mount remote directory to machine where kettle is, and try to delete file as regular.

Using ssh, i think, non trivial. It needs a lots of experiments to find out error types, to find way to distinguish errors. It might be and error with ssh connection or error to delete file.

Upvotes: 0

Srini V
Srini V

Reputation: 11355

Make use of "Run SSH commands" utility to pass commands to your remote server.

Assuming you do a rm -f /path/file it won't error for a non-existent file.

You can capture the output and perform an error handling as well (Filter rows and trigger the course of action).

Upvotes: 0

Related Questions