#1 2018-03-15 14:55

subluka
Member
Registered: 2018-03-15
Posts: 2

Help with a Pascal script for moving dirs to subdirs?

Hi,

I have a situation I wish to move many directories, say

Africa - walking 1
Africa - cityscape
UK - London
UK - Cotswalds

Into subdirectories based on the first part of the directory's name. So:

Africa/Africa - walking 1
Africa/Africa - cityscape
UK/UK - London
UK/UK - Cotswalds

I looked for ages for a utility that would do this with no luck, then I found a pascal script that I modified slightly that worked a treat in renamer. But recently my computer died and I lost it.

Now I can't seem to make any progress in finding the script I modified, or making the script again (I have absolutely no clue when it comes to pascal/languages).

I do remember it was only a few lines of code, I'm hoping someone could give some pointers. One of the problems I am having is how to capture the first word of the directory name, do I need to use regex for that?

Offline

#2 2018-03-15 23:36

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: Help with a Pascal script for moving dirs to subdirs?

You can certainly accomplish this with a Pascal Script rule, but it will be easier to use either a Regular Expressions or a Rearrange rule.

Using a Rearrange rule with the following configuration:

Split using: Exact pattern of delimiters
Delimiter: " - "
New pattern: "$1\$1 - $2"

(exclude the quotes)

Offline

#3 2018-03-16 03:43

subluka
Member
Registered: 2018-03-15
Posts: 2

Re: Help with a Pascal script for moving dirs to subdirs?

I felt this should be possible and was just trying this last night, but was getting errors because I had just "delimiters" selected.

This works great, thank you.

Offline

Board footer

Powered by FluxBB