Copying selected files while preserving folder structure

Started by cg, March 07, 2025, 10:16:00 PM

Previous topic - Next topic

cg

I'm trying to figure out a way to copy multiple selected to a different location while preserving the folder structure. The closest I'm able to find is the Image Batch Processor - Export original file unmodified. However I'm having trouble with the destination folder location.

The {p0} token doesn't work in this case it seems, as trying to copy H:\Pictures\August\Beach\image.jpg using J:\files\{p0} for the output folder resolves as  J:\files\H:\Pictures\August\Beach\image.jpg and results in an error. I can't find a token that contains the folder path without the drive.

This seems like it should be an easy task, especially because one of the main features of the Batch Processor listed in the help is "
  • Export images to external folders, with original folder structure". 
  • This looks exactly like my use case. How can I export the files to an external folder when the file path includes the drive name? Am I missing something?
  • Any help would be appreciated.
  • Thanks!



Mario


PandDLong

Perhaps a variable instead of a token?

{File.Path|substr:2} would strip the drive letter and colon leaving the path (with a leading and trailing \).  If you need to strip the trailing \ as well then {File.Path|substr:2;substrr:1} should work.


Note: I have not tried this in the batch processor myself.

Michael

cg

Success!

Both the Renamer and Batch Processor work using the {File.Path|substr:2} variable. I had been trying to figure out how to apply a regular expression to the token and got stuck, but the suggestion from @PandDLong did the trick.

I ended up using the Renamer, as its interface is better for previewing and confirming filename changes.

Thank you both!