Move Files by keeping folderstructure

Hello,
I want to move multiple Files (selected by a filename mask) with different subfolders to new location keeping the complete Folderstructure to a new location.
Example:
Existing Path
G:\NoMusic\_DblFind\Bckp_D\Documents\DVD Profiler\Reports\TEMP\File1.jpg
to new path
g:\New\NoMusic\_DblFind\Bckp_D\Documents\DVD Profiler\Reports\TEMP\File1.jpg
All AI searches in google and grok and ChatGPT didn't work so far
I cannot Customize the outputfolder with the correct tag to include to make it work
Thanks for help
Raoul
Reply to #1:

Hi Raoul,

Use the MOVE Batch mode (Change Batch mode at the top of the ARen window to "Move". Load your files, then enter the new path ( G:\New\NoMusic\_DblFind\Bckp_D\Documents\DVD Profiler\Reports\TEMP ) in the "Output folder:" field. No tags needed. Expose the "Path" and "New Path" columns in the files list to preview the move.

You can alternatively use a script, and it can be advantageous, but that's a conversation for another thread. :)

I used D: instead of G:, but here's a screenshot of the basic setup:
https://drive.google.com/file/d/1CY3_zgGErWO5z89MGQVG57r388O PpvUQ/view?usp=sharing

Best,
DF
Reply to #2:
Thanks Delta Foxtrot.
Unfortunately my question was not answered... Imagine I have a Structure
d:\Fo1\Fo2
d:\Fo3\Fo4\Fo5
These folders contain various Files which I define by a Filename Mask, example Video*.jpg
So I want all the Files under d:\ which contain Video* listed (this works)
Then I want to move these files (Other files untouched) to be Moved to
d:\Video\Fo1\Fo2 and d:\Video\Fo3\Fo4\Fo5
So my variable is the original path name (I can just select the last foldername or the 2nd last foldername, but never the complete pathname)
Tagbuilder D:\Video\<FolderName> gives me as a result d:\Video\Fo2 and d:\Video\Fo5
Tagbuilder of <FolderName> gives me just the complete path, as soon as I add another folder or drive infront the complete path vanishes
Thanks,
Raoul
Reply to #3:

NOTE! EDIT: Sorry, I screwed up... fixed now! END EDIT

Hi Raoul,

Sorry, I answered the question you asked, not the one you meant! :o Sorry...

Anyway, there's no <PathWithoutDrive> tag (or even <Path>, which would be doable), so the only way I know to do that is with a script. See if this does what you need:
EDIT: Use this with the Rename batch mode; you can also use other methods to rename the files, if needed. END EDIT
//------------------------------------------------
n = item.newBasename;
newDir = n.replace( /^([a-z]+)(.*)/i, "$1" ) ;
p = item.path;
drive = app.parseTags( '<dirname:-1>' ) ;
lastDir = app.parseTags("<dirname:1>") ;
newDir = drive + ":\\" + newDir + "\\" ;
if ( lastDir == drive ) {
item.newPath= newDir.trim() ;
return ;
}
for ( x = -2; app.parseTags("<dirname:"+x+">") !== lastDir ; x-- ) {
newDir += app.parseTags("<dirname:"+x+">\\" ) ;
}
item.newPath = newDir.trim() + lastDir.trim() ;
//------------------------------------------------

This will only work if your keyword (Video*) is followed by a non-alpha character (0-9, -, _, whatever). If that's not the case I'd need more information about filename structure to correct it.

Here's how it worked on my system:
https://drive.google.com/file/d/1MjsJxKy_pKHnvpry9Q7VN-lvlVp suLM-/view?usp=sharing

Best,
DF
Reply to #4:

Just so there's no confusion, I screwed up on the copy to the forum and left out something. It's fixed in the previous post, but here's the correct code again in case you miss the correction:
//--------------------------------------------------
n = item.newBasename;
newDir = n.replace( /^([a-z]+)(.*)/i, "$1" ) ;
p = item.path;
drive = app.parseTags( '<dirname:-1>' ) ;
lastDir = app.parseTags("<dirname:1>") ;
newDir = drive + ":\\" + newDir + "\\" ;
if ( lastDir == drive ) {
item.newPath= newDir.trim() ;
return ;
}
for ( x = -2; app.parseTags("<dirname:"+x+">") !== lastDir ; x-- ) {
newDir += app.parseTags("<dirname:"+x+">\\" ) ;
}
item.newPath = newDir.trim() + lastDir.trim() ;
//--------------------------------------------------
Sorry!
Best,
DF