Skip to main content

How to move files in an Apache Hop workflow

What this shows​

Move Files looks like Copy Files with one word changed, and most of it is. The difference is the one that matters: after a move, the files are not where they were. That single fact changes how you build the workflow around it.

Reference documentationThe complete list of Move Files options is documented in the Apache Hop manual, which is the authoritative reference.hop.apache.org →

Sample workflow​

The workflow in the video is workflows/move-files-basic.hwf, in the Putki tutorial samples project.

Transcript​

Full transcript

Move Files looks like Copy Files with one word changed, and most of it is. The difference is the one that matters: after a move, the files are not where they were. That single fact changes how you build the workflow around it.

Four actions, and the second one is here for a reason. It copies the reports into a staging folder so that the move has something to move. Without it this workflow would work once and then find an empty folder on every run after that.

The table reads the same way Copy Files does: a source, a destination, and a pattern. The wildcard is a regular expression again rather than a shell glob, so dot star backslash dot c s v dollar is how you say "the CSVs".

Simulate is the one to know about, and it exists because this action is hard to undo. With it ticked the workflow reports everything it would have moved and moves nothing. Run that first, read the list, then untick it.

The Advanced tab decides what counts as success, which is a real question once a folder can be half moved. You can insist that everything moved, accept any number of errors below a threshold, or require a minimum number of files. The workflow's next hop follows whichever answer you give.

Running the workflow stages the three reports, then moves them on.

Three files, now in the archive folder. The staging folder they came from is empty again, which is the whole point and the reason the first action exists. Run this workflow a second time and you get exactly this result, because the staging step puts the files back before the move goes looking for them.