* Changing linked media addresses in bulk

Questions about using and managing media in FH
Post Reply
avatar
crumblyhunter
Gold
Posts: 17
Joined: 28 Aug 2014 07:20
Family Historian: V6.2

Changing linked media addresses in bulk

Post by crumblyhunter »

I want to change the format of hundreds of linked media addresses from the current format (shown below) to the required format (shown below) – i.e. to move the family name so that it's before the first given name, with a comma separating it from the first given name.

I've already re-named these files in the folder where they're stored and I now need to change the link address to each of these files in Family Historian.

Is there a way to re-name the linked addresses of these media files please, without having to manually edit each filename's linked address one at a time?

Current format of file name in the linked address in Family Historian:

year - givenname1 givenname2 givenname3 familyname (<rin>) (<uniquefileidentifier>)

e.g. 1947 - William Henry Joseph Chidgey (13) (16-000376)

Required format of file name in the linked address in Family Historian:

year - familyname, givenname1 givenname2 givenname3 (<rin>) (<uniquefileidentifier>)

e.g. 1947 - Chidgey, William Henry Joseph (13) (16-000376)

I am using Family Historian version 7.0.21

Thank-you and best regards

Russell
User avatar
Vyger
Famous
Posts: 159
Joined: 15 Jan 2019 12:11
Family Historian: V7
Location: Northern Ireland

Re: Changing linked media addresses in bulk

Post by Vyger »

Russell,

I'm certainly not aware of even a Plugin to do what you wish and it is not just a simple Search & Replace. Thankfully your file naming system does appear to have repeated structure so you could write a simple script to alter the links in the Gedcom file.

It is so important to think file naming through which you appear to have done. I presented a video recently on the important considerations which also contained an 11 page document detailing the considerations of another researcher (link in description). Whilst those considerations were more detailed than my mine getting a muscle memory repeatable format is key, then it is easy to script a change which I have completed recently.

https://youtu.be/zO9J0x0Resg?si=Yr2cFCBRInCw0u4e

Jackson
Genealogy Reviews - research methods for a more productive future
avatar
crumblyhunter
Gold
Posts: 17
Joined: 28 Aug 2014 07:20
Family Historian: V6.2

Re: Changing linked media addresses in bulk

Post by crumblyhunter »

Hi Jackson

Thank-you for your primpt reply suggesting that a script might achieve the result that I'm after, but I don't know where to begin with that - any pointers please?

Russell
User avatar
Vyger
Famous
Posts: 159
Joined: 15 Jan 2019 12:11
Family Historian: V7
Location: Northern Ireland

Re: Changing linked media addresses in bulk

Post by Vyger »

You have only given one example (below), I would hope your previous applied structure is repeatable

1947 - William Henry Joseph Chidgey (13) (16-000376)

Reading above the space-open parentheses is a marker for the end of the surname in your previous structure. Reading backwards from that position the preceding space is a marker for the start of the surname.

If you have Excel you could do this using VBA, I'm sure others may suggest other apps. VBA is Visual Basic for applications and think of it as powerful macro generator in this case.

The command InStr(filename, " (") will return a numeric value for the end of surname

Using InStrRev from that position looking for the previous space will give you a numeric value for the start of surname

Other expressions like LEFT, MID and RIGHT will allow you to digitally cut up your file name and reform it using the numeric variable markers.

I don't want to go too deep here, check out some of my old videos on using VBA to write Gedcom files from spreadsheet data and pose your question on some VBA forums.

You will need to define the structure and without repeatable file naming structure the task would be next impossible.

ONLY EVER EXPERIMENT ON A COPY OF YOUR DATA
Genealogy Reviews - research methods for a more productive future
User avatar
tatewise
Megastar
Posts: 28436
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Changing linked media addresses in bulk

Post by tatewise »

It is a pity that you did not ask for advice before changing anything.

The Search and Replace plugin would make the changes you request and bulk change both the Media record links and the actual filenames simultaneously.

I need to check whether it is still possible to use the plugin to make the changes just to the Media record links. Watch this space.

I presume the number of givennames vary from file to file, but please confirm that the familyname is only ever one word.
If the familyname can be more than one word then I don't see how any automated approach is possible.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
crumblyhunter
Gold
Posts: 17
Joined: 28 Aug 2014 07:20
Family Historian: V6.2

Re: Changing linked media addresses in bulk

Post by crumblyhunter »

Hi Mike

Thanks for replying. I still have the originally-named files, so I can still work with these – I just duplicated the original folders before renaming them, just in case 'things' weren't possible and I had to revert to the original files names and keep the existing linked addresses!

The familyname is only ever one word, but of course, the givenname can be one or more names.

I did try to use the Search and Replace plugin for just one file, but I couldn't work out what to do to make the changes as I've described.

Best regards

Russell
avatar
crumblyhunter
Gold
Posts: 17
Joined: 28 Aug 2014 07:20
Family Historian: V6.2

Re: Changing linked media addresses in bulk

Post by crumblyhunter »

Vyger wrote: 15 Oct 2023 19:25 You have only given one example (below), I would hope your previous applied structure is repeatable

1947 - William Henry Joseph Chidgey (13) (16-000376)

Reading above the space-open parentheses is a marker for the end of the surname in your previous structure. Reading backwards from that position the preceding space is a marker for the start of the surname.

If you have Excel you could do this using VBA, I'm sure others may suggest other apps. VBA is Visual Basic for applications and think of it as powerful macro generator in this case.

The command InStr(filename, " (") will return a numeric value for the end of surname

Using InStrRev from that position looking for the previous space will give you a numeric value for the start of surname

Other expressions like LEFT, MID and RIGHT will allow you to digitally cut up your file name and reform it using the numeric variable markers.

I don't want to go too deep here, check out some of my old videos on using VBA to write Gedcom files from spreadsheet data and pose your question on some VBA forums.

You will need to define the structure and without repeatable file naming structure the task would be next impossible.

ONLY EVER EXPERIMENT ON A COPY OF YOUR DATA
Thanks for the suggestions Jackson – will do.
User avatar
Valkrider
Megastar
Posts: 1571
Joined: 04 Jun 2012 19:03
Family Historian: V7
Location: Lincolnshire
Contact:

Re: Changing linked media addresses in bulk

Post by Valkrider »

If you are going to try editing the gedcom directly then take a look at the free Notepad++ it has a gedcom addon which you may find useful. It has extensive search and replace options. IMHO it is easier to use than VBA in Excel.
avatar
crumblyhunter
Gold
Posts: 17
Joined: 28 Aug 2014 07:20
Family Historian: V6.2

Re: Changing linked media addresses in bulk

Post by crumblyhunter »

Valkrider wrote: 16 Oct 2023 06:50 If you are going to try editing the gedcom directly then take a look at the free Notepad++ it has a gedcom addon which you may find useful. It has extensive search and replace options. IMHO it is easier to use than VBA in Excel.
Thanks for the advice Valkrider - will do so if the Search and Replace plugin option doesn't prove to be the way ahead.
User avatar
tatewise
Megastar
Posts: 28436
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Changing linked media addresses in bulk

Post by tatewise »

The Search and Replace plugin should be able to perform the bulk renaming.

I have assumed that only the filenames need to be changed, i.e. Media record File link and actual Windows filename.
The Media record Title does NOT need changing.

The only caveat is that all file paths and names use ANSI plain text characters and no accented UTF-8 characters.

See the screenshot below and adjust the settings as described here.

Set Search Scope to Multimedia Records (OBJE)

On the Extra Filters tab ensure only the Multimedia Linked File fields & Media files option is ticked.

Enable Lua Pattern Mode so pattern matching is allowed as explained later.
Set Search: pattern to (%d+)·%-·(.*)·([^·]+)·(%(%d+%)·%(.+%))
Set Replace: pattern to %1·-·%3,·%2·%4

Click Search & Replace button and check the replacements by clicking Skip a few times.
Then click Cancel and OK.
Click Search & Replace button again but now click Replace a few times.
When happy all is going well, untick Confirm every item found and click Replace to bulk change the rest.

SearchAndReplace.png
SearchAndReplace.png (55.18 KiB) Viewed 1059 times

Explanation of Search and Replace patterns:

Search: (%d+)·%-·(.*)·([^·]+)·(%(%d+%)·%(.+%))

(%d+) captures a sequence of one or more digits, i.e. the year
·%-· but those digits must be followed by space hyphen space
(.*)· captures the given names followed by a space
([^·]+)· captures the family name that must not contain spaces but is followed by a space
(%(%d+%)·%(.+%)) captures the (rin) and (fileid)

Replace: %1·-·%3,·%2·%4

%1·-· returns the captured year followed by space hyphen space
%3,· returns the captured family name followed by comma space
%2· returns the captured given names folowed by a space
%4 returns the captured (rin) and (fileid)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
avatar
crumblyhunter
Gold
Posts: 17
Joined: 28 Aug 2014 07:20
Family Historian: V6.2

Re: Changing linked media addresses in bulk

Post by crumblyhunter »

Hi Mike

That's done the trick – many thanks for your comprehensive answer and time to help me with this. :)

Russell
Post Reply