Search code examples
sftppentaho-spoon

Delete files older than 7 days from a remote SFTP with Pentaho


I'm using Pentado Data Integration 8.2. I've little experience with Pentaho.

I need create a job with Pentaho that deletes files older than 7 days from a remote SFTP.

I searched, but I couldn't find a solution with remote SFTP.

Thanks.


Solution

  • You can use the Run ssh component to connect to your home directory. In the settings tab under the commands tab, run the following command.

    find /path/to/ \
      -type f \
      -mtime +7 \
      -name '*.txt' \
      -execdir rm -- '{}' \;
    

    This will delete all the txt files older than 7 days.