Script to move folders to different paths based on their names?

Advanced Renamer forum
#1 : 02/06-22 22:02
Spiros
Posts: 5
Hi, i would to automatically move some folders to different paths based on their names.

Lets say that i have a folder named "Temp 0206", what script should i use if i want to keep the folder name intact and move it to "X:\something\somethingelse\TEMP"

The final path should be "X:\something\somethingelse\TEMP\Temp 0206"

Thank you!
#2 : 03/06-22 12:12
David Lee
Posts: 1125
Just use Batch mode: Move and specify the Output folder.

https://www.advancedrenamer.com/user_guide/batch mode
#3 : 03/06-22 13:51
Spiros
Posts: 5
Reply to #2:

Thank you for the answer. I am aware about the batch move feature.

I may have to be a bit more clear about this.

I have multiple folders and i wonder if there is any script to move these folders automatically to different paths, as a criterion i want to use the words in folders names and keep their names intact in the new path

IF Folder Name contains "Temp X" 0101 --> X:\something\somethingelse\TEMP X\Temp X 0101
IF Folder Name contains "Temp Y" 0202 --> X:\something\somethingelse\TEMP Y\Temp Y 0202
IF Folder Name contains "Temp Z" 0303 --> X:\something\somethingelse\TEMP Z\Temp Z 0303

Thanks again!

edited: 03/06-22 13:53
#4 : 03/06-22 16:34
David Lee
Posts: 1125
Reply to #3:

You will have to be more specific about how you can identify the original folder names. Double quotes are not permitted in Windows file and folder names, so I assume that your examples are not literally correct.

Note that the UserGuide entry I quoted states:

"Example of use:
When the pattern below is used all the files will be located in a folder based on when the file was initially created.

c:\temp\output\<Year created>\<Month created>

The tags <Substr> and <RSubstr> are especially useful here."

If the target new folder name is always the same length and in the same position in the original name then that is your answer.

eg If the text is t the start of the foldername...
set Output folder: "X:\something\somethingelse\<Substr:1:6>"

Otherwise use a script with a regular expression match and set "item.newPath" to the desired path for each folder.
#5 : 03/06-22 18:29
Spiros
Posts: 5
Reply to #4:

Thanks for the help.

The double quotes were there to indicate which part of the folder name should be used in the script to identify the folder.



Let me give you a real example.


I have the folders below in path Y:\MY MUSIC\`TEMP\DJ POOLS\AR TEST

8th Wonder 2705
BarBangerz 2705
Beatfreakz 2705
BeatJunkies 2705
Beezo BeeHive 2705
bpm Latino 2705
bpm Supreme 2705
Club Killers 2705
Crate Connect 2705
Crate Gang 2705
Crooklyn Clan 2705
DJ City 2705
DMP 2705
DMS 2705
Doing The Damage 2705
FRP 2705
Heavy Hits 2705
HMC 2705
Late Night Record Pool 2705
MyMp3Pool 2705
Remix Planet 2705


What i'm triyng to achieve, is to to move these folders to the ones already existing -coresponding- folders below in path Y:\MY MUSIC\MUSIC 2022\MAY (2022)\DJ POOLS (MAY-2022)

8TH WONDER (MAY-2022)
9INCH (MAY-2022)
ACAPELLAS (MAY-2022)
BACK 2 THE FUTURE (MAY-2022)
BARBANGERZ (MAY-2022)
BEATBREAKER (MAY-2022)
BEATFREAKZ (MAY-2022)
BEATJUNKIES (MAY-2022)
BEEHIVE (MAY-2022)
BPM SUPREME (MAY-2022)
BPM SUPREME (PL) (MAY-2022)
CD POOL (MAY-2022)
CHRISTMAS PACK (MAY-2022)
CLASSIC PACK (MAY-2022)
CLUB KILLERS (MAY-2022)
CLUB KILLERS (PL) (MAY-2022)
CRACK 4 DJS (MAY-2022)
CRATE CONNECT (MAY-2022)
CRATE GANG (MAY-2022)
CROOKLYN CLAN (MAY-2022)
DJ CITY (MAY-2022)
DJ MIGHTY MOVES (MAY-2022)
DJ SLICK (MAY-2022)
DMC (MAY-2022)
DMP (MAY-2022)
DMS (MAY-2022)
DOING THE DAMAGE (MAY-2022)
EXCLUSIVE GROOVES (MAY-2022)
EXTREME REMIXES (MAY-2022)
FRP (MAY-2022)
FULL TILT (MAY-2022)
FUNKYMIX (MAY-2022)
HEAVY HITS (MAY-2022)
HMC (MAY-2022)
HYPERZ (MAY-2022)
IDJ POOL (MAY-2022)
K-BOOM (MAY-2022)
LATE NIGHT (MAY-2022)
LMP (MAY-2022)
MASS POOL (MAY-2022)
MASTERMIX (MAY-2022)
MEGATRAXX REMIXES (MAY-2022)
MIXSHOW TOOLS (MAY-2022)
MYMP3POOL (MAY-2022)
OTHER POOLS (MAY-2022)
PROMO ONLY (MAY-2022)
REDRUMS (MAY-2022)
REMIX PLANET (MAY-2022)
RETRO TRACKS (MAY-2022)
SELECT MIX (MAY-2022)
THE HIT LIST [US] (MAY-2022)
THE MASH UP (MAY-2022)
TRAKKADIXX (MAY-2022)
ULTIMIX (MAY-2022)
VDJ (MAY-2022)
XMIX (MAY-2022)


So, as an example, the 8th Wonders 2705 folder should be identified by the words "8th Wonders" (because the last four digits will be different every day, as it's an indication of the release date),

So
if folder name contains 8th Wonder Move it to Y:\MY MUSIC\MUSIC 2022\MAY (2022)\DJ POOLS (MAY-2022)\8TH WONDER (MAY-2022)

the final path should be Y:\MY MUSIC\MUSIC 2022\MAY (2022)\DJ POOLS (MAY-2022)\8TH WONDER (MAY-2022)\8th Wonder 2705



or for Club Killers 2705

if folder name contains Club Killers Move it to Y:\MY MUSIC\MUSIC 2022\MAY (2022)\DJ POOLS (MAY-2022)\CLUB KILLERS (MAY-2022)

Here is what the final path should be Y:\MY MUSIC\MUSIC 2022\MAY (2022)\DJ POOLS (MAY-2022)\DJ POOLS (MAY-2022)\CLUB KILLERS (MAY-2022)\Club Killers 2705



I have tried to play with the script i found here https://www.advancedrenamer.com/forum_thread?for um_id=12947 without any success.


Thanks again.
Much appreciated!





PS. I don't know why but for some reason, part of the post is full of double spaces.

edited: 03/06-22 18:36
#6 : 03/06-22 23:39
David Lee
Posts: 1125
Reply to #5:
Move Folders
Output folder: Y:\MY MUSIC\MUSIC 2022\MAY (2022)\DJ POOLS (MAY-2022)\<RSubstr:6:100> (MAY-2022)
#7 : 04/06-22 11:56
Spiros
Posts: 5
Reply to #6:


Thanks a lot.
This one is working great.

I thought it would be more difficult than that and i omitted the obvious one, so i've spend time trying some scripts although it was much easier.