Jump to content
TNG Community
JP Ford

massive Media rename sequence

Recommended Posts

JP Ford

A user on the FB group wants to rename 1472 media files; 1,410 of the files are unlinked. All must be renamed. The user isn't very tech savvy and doesn't have access to phpMySql, but does have FTP.   The unlinked files can simply be deleted form the TNG media table, then imported back in after they're renamed and uploaded back to the TNG media folder. Sadly, it looks like the linked files are going to have to be manually edited one-by-one from the TNG media record interface.

Regarding the linked files that require manual editing; At what point in the sequence of the "download > rename > upload > manually edit record"  process should the existing (old filename) files be deleted from the TNG media folder?  Does it matter? I was thinking that keeping the old file in place until the end might avoid any issues with broken links, but I don't really know if that's true.

Share this post


Link to post
Share on other sites
Michel KIRSCH

.. Try to delete one media before editing it...

If TNG can't edit it, keep all the old media in the directory while renaming is not finished...

Share this post


Link to post
Share on other sites
Michel KIRSCH

Renaming a media in the folder have no importance for TNG.

You can edit the media, TNG see nothing until you try to view the media.

So you can rename all the medias, then edit them one by one to give TNG the right file name for the media

 

Share this post


Link to post
Share on other sites
JP Ford
58 minutes ago, Michel KIRSCH said:

Renaming a media in the folder have no importance for TNG.

You can edit the media, TNG see nothing until you try to view the media.

So you can rename all the medias, then edit them one by one to give TNG the right file name for the media

 

Understood, manually editing 1500 records one by one is not something anyone should ever do. Sadly, that may be their only choice as I've just found out that they've spent years adding data to the media records (Description, Date Taken, as well as narratives) via the TNG interface, so each one has significant and critical data attached to the tng_media records. I'm assuming cannot delete them without losing the data. 

Share this post


Link to post
Share on other sites
Michel KIRSCH

Again: deleting physical photos does not alter the data in the tables.
So they can rename the physical photos in their directories.
Then,  they have to edit each media, one by one and reassign the new photo to the media.
This is the only solution via TNG, but all the data they put into the media stay unchanged.
Other solution, take note of the new name of the physical photo as you go along and run a query that will change the names in the tng_media table.
UPDATE tng_media SET mediakey = 'photo_new_name' WHERE mediakey = 'photo_old_name'
and eventually (it depends on how their medias are organized)
UPDATE tng_media SET path = 'photo_new_name' WHERE path = 'photo_old_name

Work in perspective ! :)

Michel

Translated with www.DeepL.com/Translator (free version)

Share this post


Link to post
Share on other sites
Michel KIRSCH

... and if there is a logic in their rename operation (by example add something to the existing name)

all can be done with PHP programming : rename and SQL in the tables in one pass.

Michel

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×