* Renaming filenames
Renaming filenames
I am about to commence tidying up my media files of documents (3000+). Unfortunately, my media folders contain files some of which are linked to my FH project, others are not.
My plan is to mark those media files already linked to my FH project, so that I can then check, and add if appropriate, the others.
To aid this my plan is to add two underscore characters to the beginning of the linked filenames thus differentiating the linked files from the rest.
Also, if possible I would like to have the FH Media Record Number added to the end of the linked filename.
When I have finished the checking process I would then like to remove the underscores.
I presume a plugin would be needed for this. Unfortunately, I am not sufficiently knowledgeable to be able to write one.
I have been looking at the Rename Selected Media Files plugin, and the forum discussions of the same, but I do not want to copy the Media Title to the filename.
I am a reasonably experienced user of FH, since 2016 (TMG migrant).
Any advice or help would be greatly appreciated. Thank you.
My plan is to mark those media files already linked to my FH project, so that I can then check, and add if appropriate, the others.
To aid this my plan is to add two underscore characters to the beginning of the linked filenames thus differentiating the linked files from the rest.
Also, if possible I would like to have the FH Media Record Number added to the end of the linked filename.
When I have finished the checking process I would then like to remove the underscores.
I presume a plugin would be needed for this. Unfortunately, I am not sufficiently knowledgeable to be able to write one.
I have been looking at the Rename Selected Media Files plugin, and the forum discussions of the same, but I do not want to copy the Media Title to the filename.
I am a reasonably experienced user of FH, since 2016 (TMG migrant).
Any advice or help would be greatly appreciated. Thank you.
Jean
- LornaCraig
- Megastar
- Posts: 2996
- Joined: 11 Jan 2005 17:36
- Family Historian: V7
- Location: Oxfordshire, UK
Re: Renaming filenames
Hello Jean, welcome to FHUG.
The first thing to say is that if you change the names of the files which are already linked to FH they will become unlinked. Are you aware of that? When you change the name FH will no longer be able to find them. I know you plan to remove the two underscore characters when you have finished but if you have also added the Media record ID number to the file name you will need to 'tell' FH the new filenames.
Are you aware of the Check for Unlinked Media plugin? That will produce a list of files which are in the Media folder but not linked to FH. Perhaps you could use that list as a basis for marking the unlinked files with a double underscore, rather than marking the linked files. Then as you link each one you can remove the underscores just before linking.
Adding the Media record ID to the end of each filename could probably be done with a plugin but the plugin would also need to adjust the filepaths so that FH recognises the new filename.
The first thing to say is that if you change the names of the files which are already linked to FH they will become unlinked. Are you aware of that? When you change the name FH will no longer be able to find them. I know you plan to remove the two underscore characters when you have finished but if you have also added the Media record ID number to the file name you will need to 'tell' FH the new filenames.
Are you aware of the Check for Unlinked Media plugin? That will produce a list of files which are in the Media folder but not linked to FH. Perhaps you could use that list as a basis for marking the unlinked files with a double underscore, rather than marking the linked files. Then as you link each one you can remove the underscores just before linking.
Adding the Media record ID to the end of each filename could probably be done with a plugin but the plugin would also need to adjust the filepaths so that FH recognises the new filename.
Lorna
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
I endorse what Lorna says about using the Check for Unlinked Media plugin that lists the unlinked files.
To synchronise filename changes, use the Search and Replace plugin that ensures any change to Media record File links are reflected in the actual filename itself, i.e. both the Media record File link value and the Media folder filename are kept in sync.
However, adding Media Record Id to the filename would need a custom Plugin to be written.
May I ask what is your thinking behind adding those Record id to the filenames?
It is relatively unusual to need to interrogate the Media folder files to discover their parent Media record.
The FH Media tab can list entries in filename order and Tools > External File Links provides an association between Media filenames and their parent Media record id, so the Record Id does not to be in the filename.
To synchronise filename changes, use the Search and Replace plugin that ensures any change to Media record File links are reflected in the actual filename itself, i.e. both the Media record File link value and the Media folder filename are kept in sync.
However, adding Media Record Id to the filename would need a custom Plugin to be written.
May I ask what is your thinking behind adding those Record id to the filenames?
It is relatively unusual to need to interrogate the Media folder files to discover their parent Media record.
The FH Media tab can list entries in filename order and Tools > External File Links provides an association between Media filenames and their parent Media record id, so the Record Id does not to be in the filename.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Thank you Lorna.
I do understand the potential for breaking the link. The Rename Selected Media Files plugin changes the name of the file and changes the name in the Media File line so they both match. I have experimented a little, a very little, with that as per the discussions in the two threads; but I don't have the knowledge to solve my problem. (Renaming Media Files: 08 Jan 2017 03:22: viewtopic.php?f=32&t=14536) and (re naming source/media files: 28 Jan 2020 01:05: viewtopic.php?f=32&t=17412)
That plugin uses the Media Title as the 'pattern' for the changed filename. I wonder if there is any way in which the actual filename could be 'read' and amended (text added to the beginning and/or to the end).
I am embarrassed to say that I had forgotten about the Check for Unlinked Media plugin. I have just tried that plugin but it does not work. I do not keep my media in the FH Project Folder (not 'advised' I know, but I have a very long-standing folder system and another piece of software --photo storage--involved with the files).
Mike, Thank you too.
I have made great use of your Search and Replace plugin (what a boon it is) but never with regard to Media files. S&R is not really useful to me at this stage.
I use ID numbers a great deal, it suits my way of thinking. Having the Media Record ID added to the end of the filename would enable me to see at a glance in Windows Explorer which files have been included in FH (and would mean that I would not need to add initial underscores to differentiate between linked and unlinked files). Having the number at the beginning of the filename throws out my sorting order for the filenames.
I understand that normally everything can be located, viewed etc. in FH. That is where I am heading. Although I have been using FH since 2016, it is only in the last couple of years that I have been using it very seriously. For some reason, which now escapes me, I did not link my original files to FH. There are probably all sorts of duplications, under different filenames, so I need to check those files against those linked to FH. The files had been gathered over many years from various suppliers without my imposing a consistent naming system (relying on the supplier's filename). I have now developed my 'style' and use it for new files. It is so easy to link to FH that now I link all newly downloaded files straightaway.
For the checking process of these old files I find that working through the list of files in Windows Explorer works best for me.
Again, thank you both.
I do understand the potential for breaking the link. The Rename Selected Media Files plugin changes the name of the file and changes the name in the Media File line so they both match. I have experimented a little, a very little, with that as per the discussions in the two threads; but I don't have the knowledge to solve my problem. (Renaming Media Files: 08 Jan 2017 03:22: viewtopic.php?f=32&t=14536) and (re naming source/media files: 28 Jan 2020 01:05: viewtopic.php?f=32&t=17412)
That plugin uses the Media Title as the 'pattern' for the changed filename. I wonder if there is any way in which the actual filename could be 'read' and amended (text added to the beginning and/or to the end).
I am embarrassed to say that I had forgotten about the Check for Unlinked Media plugin. I have just tried that plugin but it does not work. I do not keep my media in the FH Project Folder (not 'advised' I know, but I have a very long-standing folder system and another piece of software --photo storage--involved with the files).
Mike, Thank you too.
I have made great use of your Search and Replace plugin (what a boon it is) but never with regard to Media files. S&R is not really useful to me at this stage.
I use ID numbers a great deal, it suits my way of thinking. Having the Media Record ID added to the end of the filename would enable me to see at a glance in Windows Explorer which files have been included in FH (and would mean that I would not need to add initial underscores to differentiate between linked and unlinked files). Having the number at the beginning of the filename throws out my sorting order for the filenames.
I understand that normally everything can be located, viewed etc. in FH. That is where I am heading. Although I have been using FH since 2016, it is only in the last couple of years that I have been using it very seriously. For some reason, which now escapes me, I did not link my original files to FH. There are probably all sorts of duplications, under different filenames, so I need to check those files against those linked to FH. The files had been gathered over many years from various suppliers without my imposing a consistent naming system (relying on the supplier's filename). I have now developed my 'style' and use it for new files. It is so easy to link to FH that now I link all newly downloaded files straightaway.
For the checking process of these old files I find that working through the list of files in Windows Explorer works best for me.
Again, thank you both.
Jean
Re: Renaming filenames
Would not a better idea than renaming the files be to run the plugin "Check for unlinked Media" (after running a full backup) and select the option to move the unlinked media to a separate folder. That would then leave in the Media folders the set of media which is already linked to the project and unlinked media in a different folder. The unlinked media items can then be moved back to the relevant Media folders before being linked in the project.
I have been thinking of doing this, as I have a lot of media (photos, documents, newspaper items, etc) which have not yet been linked, but are in the Media folders. I also have a lot of census forms, parish register images and BMD certificates which I have downloaded more recently and placed in "Unlinked Media" folders ready to be added by Ancestral Sources.
No doubt someone will correct me if this is not a good way to approach the probem.
Mick
I have been thinking of doing this, as I have a lot of media (photos, documents, newspaper items, etc) which have not yet been linked, but are in the Media folders. I also have a lot of census forms, parish register images and BMD certificates which I have downloaded more recently and placed in "Unlinked Media" folders ready to be added by Ancestral Sources.
No doubt someone will correct me if this is not a good way to approach the probem.
Mick
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
@Mick: Jean has explained why that Plugin won't work for her externally stored Media.
It will probably work for you as long as your Media are within the Project.
@Jean: Is it possible your photo storage system could work on the Media folder inside the FH Project?
It is an ordinary Windows folder just like all the others. It can have a sub-folder structure just like any other folder.
Or does your photo storage system include a lot more images that are nothing to do with FH.
It will probably work for you as long as your Media are within the Project.
@Jean: Is it possible your photo storage system could work on the Media folder inside the FH Project?
It is an ordinary Windows folder just like all the others. It can have a sub-folder structure just like any other folder.
Or does your photo storage system include a lot more images that are nothing to do with FH.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Thanks Mike.
I was typing my reply as Jean posted her response, so I didn't see that her system for storing media is not the same as mine until I had posted my message.
Mick
I was typing my reply as Jean posted her response, so I didn't see that her system for storing media is not the same as mine until I had posted my message.
Mick
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
OK, but having spotted her reply, did you know you can go back and edit your reply using the Edit post pencil icon?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Thank you MickRalph. I have tried several ways of checking (and organising) the files and I prefer the files to be batched together, albeit in groups: census, newspapers, births/marriages/deaths etc. As well as checking for duplicate images, quite often I am comparing the quality of the scans (some of the old census ones were poor).
Mike: Yes, the photo storage does contain images that are nothing to do with FH...and I am a bit set in my ways as to the folder structure of my drives. (The family tree research filenames were a complete mess but everything else isn't.)
I am paying the price of not having worked out a sensible system back in the 1990s when I started collecting scans of documents, of not being able to link files to the earlier FT software, and of not properly addressing the situation over the years with the various FT software I have used.
Mike: Yes, the photo storage does contain images that are nothing to do with FH...and I am a bit set in my ways as to the folder structure of my drives. (The family tree research filenames were a complete mess but everything else isn't.)
I am paying the price of not having worked out a sensible system back in the 1990s when I started collecting scans of documents, of not being able to link files to the earlier FT software, and of not properly addressing the situation over the years with the various FT software I have used.
Jean
Re: Renaming filenames
Mike, thanks for reminding me that I should have edited my post to acknowledge Jean's post arriving before mine. I am not very familiar with this forum software, although I am active in the fora for another hobby, so I should have thought to edit it.
Mick
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
Jean, I'm not sure what to suggest.
The Check for Possible Duplicate Media plugin will report any duplicate files linked to the Media records in FH.
That even identifies files with different names but the same contents as duplicates.
It should work for files stored outside the Project like yours.
Have a look at the FH Tools > External File Links... command that lists all linked files in the same order and folder structure as Windows File Explorer, so it is easy to compare and spot unlinked files.
When you select a file in the File Links list it shows the associated Media record below in Where Used with its Record Id.
The Check for Possible Duplicate Media plugin will report any duplicate files linked to the Media records in FH.
That even identifies files with different names but the same contents as duplicates.
It should work for files stored outside the Project like yours.
Have a look at the FH Tools > External File Links... command that lists all linked files in the same order and folder structure as Windows File Explorer, so it is easy to compare and spot unlinked files.
When you select a file in the File Links list it shows the associated Media record below in Where Used with its Record Id.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Thank you Mike.
Yes, the Check for Possible Duplicate Media plugin does work with my setup but, alas, the duplicate files are not within the FH project. Many moons ago, being unable to link files to the FT software I used then, I would enter the information and simply store the files on the computer. I am trying to sort out those files, but some, I am sure, will have been superseded by newer, clearer images obtained later.
Anyway, I have been able to tweak the Rename Selected Media Files plugin to change the filename by adding the FH media record number to the end of the filename (rather than to the beginning). I noted that double underscore characters were changed to single ones, and I have found and changed the code making that change (I use double underscores to draw my eye to certain parts of a filename).
I have to thank Jane for being the original writer of the plugin, and to you, Mike, for your adaptation, as well as providing very clear instructions in the above-mentioned threads with regard to acceptable and modified characters. I have used many plugins but have never before modified one.
Yes, the Check for Possible Duplicate Media plugin does work with my setup but, alas, the duplicate files are not within the FH project. Many moons ago, being unable to link files to the FT software I used then, I would enter the information and simply store the files on the computer. I am trying to sort out those files, but some, I am sure, will have been superseded by newer, clearer images obtained later.
Anyway, I have been able to tweak the Rename Selected Media Files plugin to change the filename by adding the FH media record number to the end of the filename (rather than to the beginning). I noted that double underscore characters were changed to single ones, and I have found and changed the code making that change (I use double underscores to draw my eye to certain parts of a filename).
I have to thank Jane for being the original writer of the plugin, and to you, Mike, for your adaptation, as well as providing very clear instructions in the above-mentioned threads with regard to acceptable and modified characters. I have used many plugins but have never before modified one.
Jean
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
You say:
Check for Possible Duplicate Media plugin does work with my setup but, alas, the duplicate files are not within the FH project.
I'm not sure what you mean. Only files that are linked to the Project are checked by the plugin.
So if it is finding duplicates then they are duplicated in the Project even though the files are external to the Project.
i.e. There external files that are identical and linked to different Media records in the Project and thus could be merged.
Excellent work in adapting the renaming Plugin. The more users who learn to write Plugins the better.
Check for Possible Duplicate Media plugin does work with my setup but, alas, the duplicate files are not within the FH project.
I'm not sure what you mean. Only files that are linked to the Project are checked by the plugin.
So if it is finding duplicates then they are duplicated in the Project even though the files are external to the Project.
i.e. There external files that are identical and linked to different Media records in the Project and thus could be merged.
Excellent work in adapting the renaming Plugin. The more users who learn to write Plugins the better.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Apologies Mike, I am not making myself clear.
The plugin does work in my system, but it found no duplicates (as I expected).
The files unlinked to FH may contain (probably will contain) duplicates of some of the images linked to FH, although under different filenames.
I don't see myself ever writing a plugin but I am pleased that I may be able to modify the odd one.
The plugin does work in my system, but it found no duplicates (as I expected).
The files unlinked to FH may contain (probably will contain) duplicates of some of the images linked to FH, although under different filenames.
I don't see myself ever writing a plugin but I am pleased that I may be able to modify the odd one.
Jean
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
Plagiarising existing Plugins is an excellent skill to acquire as Plugins often require tweaking to fit your particular needs.
General-purpose Plugins to be published in the Plugin Store for everyone to use often need more script to cater for users various requirements than is needed for the basic algorithm. If the basic script was published and users could adapt it for their purposes then perhaps more Plugins would get published, but would need a caveat that users may need to modify it for their own needs.
General-purpose Plugins to be published in the Plugin Store for everyone to use often need more script to cater for users various requirements than is needed for the basic algorithm. If the basic script was published and users could adapt it for their purposes then perhaps more Plugins would get published, but would need a caveat that users may need to modify it for their own needs.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Mike,
Your post in this thread, on the 3rd Mar 2021 15:34
I have an individual Media folder for each "Surname" in my Project. Within this folder I then have a folder for "Documents", "Images", "Newspaper" and "www.site". I have made a spelling mistake of the surname of one of these Surname folders and wish to correct the error. I know that if I amend the surname to its correct spelling, I will loose all of the links to all of the individual files nested within the Project, Media, "Surname" folder. So, how do I make the correction?
I am at present running Family Historian v6.2.7 and using AS v7.2.4 to populate my Projects.
Thank you for your time and advice.
Good health for 2022.
BillR
Your post in this thread, on the 3rd Mar 2021 15:34
I think this answers my query, but having never used "plug-ins" and being nervous, as we have previously discussed on this forum, I am wary of assuming what I need to do.I endorse what Lorna says about using the Check for Unlinked Media plugin that lists the unlinked files.
To synchronise filename changes, use the Search and Replace plugin that ensures any change to Media record File links are reflected in the actual filename itself, i.e. both the Media record File link value and the Media folder filename are kept in sync.
I have an individual Media folder for each "Surname" in my Project. Within this folder I then have a folder for "Documents", "Images", "Newspaper" and "www.site". I have made a spelling mistake of the surname of one of these Surname folders and wish to correct the error. I know that if I amend the surname to its correct spelling, I will loose all of the links to all of the individual files nested within the Project, Media, "Surname" folder. So, how do I make the correction?
I am at present running Family Historian v6.2.7 and using AS v7.2.4 to populate my Projects.
Thank you for your time and advice.
Good health for 2022.
BillR
Re: Renaming filenames
If all your folders (including the one you need to rename) are sub folders of the projectname.fh_proj\Media folder, for what you need to do you don't need to use a plug in - it's much simpler than that:
I had all of my files in the Media directory with no sub-folders (ignorance when I started using FH). I created a complete set of sub folders with some going to more than one level down, moved all the files to the righr directory in Windows Explorer, ran through the above procedure and it sorted all 100+ files out.
- Rename the folder to what it should be in Windows Explorer
- In Family Historian select External Files Link from the Tools menu
- Tick the check box Show Broken Links Only it will show you a list of the files in the folder you renamed. If this is right continue and
- Click the button Auto Repair Links. It will find the files in the renamed folder and repair the links for you. You'll get a report like this:
- Click Close
- Click OK
I had all of my files in the Media directory with no sub-folders (ignorance when I started using FH). I created a complete set of sub folders with some going to more than one level down, moved all the files to the righr directory in Windows Explorer, ran through the above procedure and it sorted all 100+ files out.
John Elvin
Re: Renaming filenames
Good morning Jelv,
Thank you very much for your clear explanation for dealing with my little conundrum. I shall give it a shot later today and post the outcome.
Good health, BillR
Thank you very much for your clear explanation for dealing with my little conundrum. I shall give it a shot later today and post the outcome.
Good health, BillR
- tatewise
- Megastar
- Posts: 27082
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Renaming filenames
Unfortunately, John did not spot that you are using FH v6.2.7 and so some of his instructions are inaccurate.
There is no check box Show Broken Links Only that was only added to FH v7.
So, you will have to scroll through if you wish to check where the broken links exist.
However, in this case, because it is only a folder name change, the button Auto Repair Links should work.
If it had been filename changes then that process does not work.
I am also always a little wary about advising users to delve into the Project folder structure with File Explorer.
There is no check box Show Broken Links Only that was only added to FH v7.
So, you will have to scroll through if you wish to check where the broken links exist.
However, in this case, because it is only a folder name change, the button Auto Repair Links should work.
If it had been filename changes then that process does not work.
I am also always a little wary about advising users to delve into the Project folder structure with File Explorer.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Renaming filenames
Oh dear!
I know that I am not the sharpest tack when it comes to software, but this .......!
My apologies, but could you be more explicit about the "How and Where" of this elusive button?
Thank you for your time.
BillR
Having spent an hour reading the 'Help' and looking through various screens, I have yet to find this 'Auto Repair Links' button that you speak of Mike. I cannot see anything on the screen windows or find anything in the 'Help' descriptions that talks of or looks like a 'Auto Repair Links' button.However, in this case, because it is only a folder name change, the button Auto Repair Links should work.
I know that I am not the sharpest tack when it comes to software, but this .......!
My apologies, but could you be more explicit about the "How and Where" of this elusive button?
Thank you for your time.
BillR
Re: Renaming filenames
Aye John, thank you
that worked very nicely and I see that I have more work to do, as some other media links to different folders/files were unable to be repaired.
My thanks also to you Mike and to BillH for the image.
BillR
My thanks also to you Mike and to BillH for the image.
BillR