Assuming we have the following file path:
In order to get the root directory or subfolder, use the “Get file part path” action. Click the {x} button and select FilePath. After running the flow, you can see in the variable pane that this allows you to obtain the FileName, File Extension, as well as the RootPath.