How to delete files/folder on the server

Hi,

Every time I run the WF, csv files will be created on the KNIME server in WF location. I need to delete the files after n days, To achieve the delete functionality I need to create a WF to delete the files in WF repo and schedule it to run on certain time.

I had below nodes

1. List Files

with URL - knime://knime.workflow/…/…/FileDownload_WF/Results/ and get the list of files with URL
Examle URL : knime://knime.workflow/…/…/FileDownload_WF/Results/2020-01-01/test.csv.

To pass the URL to Delete Files node I need to convert the file URL to Path in server.
Can someone please suggest how to get the path of a file in knime-server?

PS: String to Path, URL to Path node will work only in local not with server url’s

There is different ways to resolve this. Assuming you are on 4.11/4.2 something like this should do the trick for you:

2 Likes

Hi @marten_kose,

Can you please provide .knwf of your workflow?
Thanks in advance!

I’m afraid I do not have this workflow available anymore, but there are other examples on how to use the file handling framework in combination with KNIME Server, e.g. Work with File Names and Moving Files. – KNIME Hub