Renaming files

Hi there,

How can I rename a number of files that are alphabetically ordered into new files that are numerically ordered?

In other words, I’d like to rename files called xxx.a into xxx.001; xxx.b into xxx.002; …..



Not sure you can actually rename files in KNIME (may be others do!). But you can read in a file, and save it out by a new name. So you could certainly do what you describe, but will be left with the original files.

You could do this using the List Files node,then

- Maths node using RowIndex to get the file extension basically, i.e. 1, 2, 3 etc.

- TableRow To Variable LoopStart,

- File Reader, using the Variable for the file entry

- Variable to TableRow node, passing out the filename and RowIndex.

- Using a combination of Column Splitter (using . as the splitting point)

- And then a Column Combiner to recombine filename xxx with the RowIndex, etc.

- Then a TableRow to Variable to pass this new filename back to a variable.

- Then a File Writer of choice, using the filename to save as from the variable.

- And a Variable Loop End node, connected from the File Writer top right part of the node.

Hope that gives you the general idea.