I would like to change the location of a number of files that are in the database.
I thought I could do it simply via CSV export and import. But, the filename field in the csv export cannot be modified et reimported.
I have also tried doing this via an SQL query. But there, it is my knowledge in SQL which is too limited.
I created a MODIF attribute and I put the field on “yes” for all the files that I want to move.
Here is the query:
UPDATE items SET filename=REPLACE(filename, 'Musique', 'Divers') FROM items i LEFT JOIN item_attributes a1 ON a1.item=i.idx AND a1.name='MODIF' WHERE a1.value='oui';
Well, let’s just say that’s not the most comfortable solution.
Is there a comfortable and safe solution to be able to move files to a new location, keeping the same ID in the database and deleting the original files?