Renaming File on Knime Hub

Hi everyone,

I am building a workflow for deployment on KNIME Hub where a user uploads a file. During the process, a long unique ID string gets appended to the filename (e.g., reports.pdf becomes reports123-e344.pdf).

I need to rename this file back to a clean, short name (e.g., just reports.pdf) dynamically within the workflow.

The Constraints:

  1. Deployment: This runs on KNIME Hub (Linux server), so I cannot rely on local Windows paths or standard os.rename in Python, as I don’t have easy access to the absolute server paths.

  2. The Issue: Most solutions I found suggest using the Transfer Files node in “Move” mode. However, in my testing, the Transfer Files node only seems to allow setting a destination folder path, not a full destination file path.

    • Result: It moves the file to the right folder but keeps the long, messy filename.

My Question: Is there a specific configuration or a different node I should be using to explicitly set the target filename during a move/rename operation? Or is there a server-safe way to handle this file renaming?

Thanks in advance!

Hi @PanteleyShmele1 ,

currently this only works with the Transfer Files (Table) – KNIME Community Hub node.

It requires an input table with two columns:

  • the full path to the file as source, and
  • the full path with the file renamed to be used as destination.

I don’t know why there seems to be no more straightforward way for single files. Maybe that wasn’t a common use case in the past, but I do think we should improve this. A ticket with a similar request has been opened recently (internal reference AP-25392).

I hope this helps for now,

nan

4 Likes

@PanteleyShmele1 the old Column Expressions node does support Path variables. So, you can construct something like this where the original file is being copied with the new name (and location if you want) and then the old one is being deleted. This is not ideal. But it does work.

2 Likes

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