I have a table like this:
I recently made a change in my linux machine by organizing all the images into their respective folders, using a bash script (see answer and solution here:https://stackoverflow.com/a/72427271/9999674):
I had about 13k images and they all start with a unique identifier, each identifier has many images. I decided to put all images with the same identifier in the same folder, named after the identified.
Now I have to update my database so it still points to the correct directory. I want to change the table from the output you saw above, to this:
Is there a way we can automate this? Maybe the equivalent of a bash script for SQL? Like an SQL function? or simply a very elaborate SQL query involving ifs and for loops?
PS: Some of my rows already have this path/to/newly_created_folder/file.ext so I want the query to ignore this so it doesn’t replace it again.