# Efficient workflow for tag folder structure tidy-up

**URL:** <https://forum.inductiveautomation.com/t/efficient-workflow-for-tag-folder-structure-tidy-up/54533>\
**Category:** Ignition\
**Created:** [December 30, 2021, 12:47am UTC](https://forum.inductiveautomation.com/t/efficient-workflow-for-tag-folder-structure-tidy-up/54533 "2021-12-30T00:47:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 30, 2021, 12:47am UTC](https://forum.inductiveautomation.com/t/efficient-workflow-for-tag-folder-structure-tidy-up/54533/1 "2021-12-30T00:47:46Z")

</div>

I want to take advantage of the holiday shutdown to do a bit of a tidy-up our OPC tag folder structure which was badly set up initially and contains misplaced tags and spelling mistakes.

As far as I can see I need to do the following:

1. Back up the _sqlth\_te_ table (which contains the index and tagpaths used by the Historian) and the projects to be fixed.
2. Make the changes to the tag names and tagpaths (taking care to note each change).
3. Write queries to update the _sqlth\_te_ table tagpaths.
4. Open the relevant projects and use _Find / Replace_ to update to the new values.

What am I missing here? Has anyone had this go very well or badly wrong?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [December 30, 2021, 3:18am UTC](https://forum.inductiveautomation.com/t/efficient-workflow-for-tag-folder-structure-tidy-up/54533/2 "2021-12-30T03:18:58Z")

</div>

You could also use the audit log as it captures tag changes including moves/renames

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [December 31, 2021, 7:08pm UTC](https://forum.inductiveautomation.com/t/efficient-workflow-for-tag-folder-structure-tidy-up/54533/3 "2021-12-31T19:08:34Z")

</div>

Job done. Here are a few tips:

1. I tried using mySQL Workbench to back up the _sqlth\_te_ tables but it was making very slow progress. This seems to be a bug in mySQL. In the end I executed the following commands from a CMD window.

```auto
C:\>mysqldump -u root -p myDBname sqlth_te > "c:\myDir\myDBname.sqlth_te.sql"

```

1. I corrected the mis-spelt folder name in the Ignition Tag Browser.

2. I updated the _sqlth\_te_ table. In my case one of the tag folders had got an ‘Ò’ in it instead of a regular ‘O’ and we didn’t notice until we had done quite a bit of work. The following query fixed that. See [StackOverflow](https://stackoverflow.com/a/28316067/3934992) for details on why `id <> 0` is required.

```sql
UPDATE myDBname.sqlth_te
SET tagpath = REPLACE(tagpath, 'ò', 'o')
WHERE (tagpath LIKE '%ò%' AND id <> 0)

```

1. I opened each project likely to be affected and ran the Find/Replace tool. A couple of points on this:

- Make sure you select _Views | All Views_ and _Windows | All Windows_.
- The tool is case sensitive. I had to repeat the job for ‘Ò’ and ‘ò’ as Ignition converts some of the paths to lowercase in some places.

Save and launch your application to check.
