photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: cg on March 07, 2025, 10:16:00 PM

Title: Copying selected files while preserving folder structure
Post by: cg on March 07, 2025, 10:16:00 PM
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 "


Title: Re: Copying selected files while preserving folder structure
Post by: Mario on March 07, 2025, 11:16:46 PM
Try the Renamer?
Title: Re: Copying selected files while preserving folder structure
Post by: PandDLong on March 07, 2025, 11:42:49 PM
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
Title: Re: Copying selected files while preserving folder structure
Post by: cg on March 08, 2025, 12:52:08 AM
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!