Originally Posted By: MG2009
All I know is that the script above achieved the goal with no unwanted behaviours within either the Finder Windows or the folders/subfolders.

I will let you all know if my computer starts to behave badly from today's actions.

Like I said, there is nothing mission-critical in the .DS_Store files. Nothing is going to start behaving badly.

You lost all your preview icons, but no matter. Finder will re-generate them. You did not lose custom icons, which are attached directly to the file/folder and not in .DS_Store. I know it's easy to get custom icons and preview icons mixed up, but there is a difference.

You lost icon placement in all your folders. When you look at a folder in Icon View, you'll see the icons arranged in their default order. If you never bothered to arrange your icons in any special order, you won't notice, and this is not an unwanted behavior. The next person who comes here wondering if it's OK to trash .DS_Store files may have spent a lot of time arranging icons just so, and will be devastated to see all their hard work thrown out. For all I knew, you had spent time arranging icons, and it didn't occur to you that resetting background color would be connected to icon placement in any way. "Unwanted behavior" is in the eye of the beholder.

You lost all your Finder comments. There are people who live and die by Finder comments. Pre-OSX, when comments were saved in the Desktop Database, there were utilities whose claim to fame was that they would suck up all the Finder comments from the database, rebuild it, then put all the comments back in. That gave people a way to rebuild the desktop without losing their comments, which was much appreciated.

Interestingly, Spotlight still has all the Finder comments cached. You may see Spotlight finding files/folders that you see no reason for it to find. Finder doesn't know about Spotlight's cache, so when you Get Info you'll see the comment field blank. ("Cached" is maybe not really the right word. Finder attaches a comment to a file in two places, but only looks in one (namely, .DS_Store). Spotlight sees the other.)

Anyway, I'm glad you found a solution that works for you.