You can use the Get File Attribute action to get the Parent Path, and extract the hierarchy from that. But perhaps better would be to use a RegEx to extract the hierarchy of interest:
Put these inside of the KM For Each Action, where FilePath is the For Each variable. Note: I tested the RegEx, but the ==Move is untested.==
You will need to change the paths of INPUT_FOLDER and OUTPUT_FOLDER to match your setup.
ACTIONS: Extract Relative File Path
Note: This is a download of ACTIONS, which will be ==immediately inserted into the current macro at the current location== when you import to KM.
You probably want to add in a lower-case “p” to preserve various attributes.
cp -pPR sourcePath destinationPath
“-p Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved.”