Delete Files/Folders should not fail

I would like to use a node Delete Files/Folders to clean a directory. This directory should be filled in the workflow with new files.
If the directory is not available, the delete node fails and stops the workflow.

Sure it is right, that it couldn’t delete something but that’s correct. The checkbox “Fail if delete fails” is unchecked and the workflow is still stopped.

What can I do, that if the folder exists it is deleted and if it doesn’t exists the workflow isn’t stopped?

Hello @Axelb1971,

and welcome to KNIME Community!

As a workaround you can try following. Use Create Folder node with desired directory. How does it works (at least when I have tested it) is it will create this directory/folder if it’s missing and won’t do anything if it already exists. Then Delete Files/Folders shouldn’t fail.

Of course, there are other ways to tackle this but if works this seems like simplest and fastest. Give it a try and let me know how it works.

Br,
Ivan

2 Likes

Hi Ivan,

this works, thanks. It’s a good work-a-round.
Do you know, why the delete node fails, still with the unchecked box for failing?

kind regards
Axel

1 Like

Hello @Axelb1971,

well I think it’s only related to successful deletion of files and not folder existence. For that new option should be added (checkbox) which would allow to handle node behavior in case folder does not exist. But this is question for someone on KNIME team.

Br,
Ivan

:wink: the same behavior happens if you try to delete a non existent file.

Maybe really something for the KNIME team.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.