Thread Tools Display Modes
05-15-17, 11:13 PM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
How to remove unused addons lua settings

Hi,
once there was the old curse client that have a function to delete the unused (not present anymore) addons setting *.lua and *.bak .
This very handy functionality was removed in the new Curse/Twitch client. I don't find in Minion either.

So I am here to ask if there is a program, a batch file, something that could do the job.

Thanks.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
05-15-17, 11:21 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Sort by date modifed and delete the ones not updated when you last exited WoW + all the .bak files, as far as I know, they've never been used but they will come back for current addons.

Edit: I don't believe any Blizzard (non addon) information is stored in .lua files (.wtf, .txt and .md5) so a search in Explorer from the WTF\Account level for *.lua and *.bak should get them all in two sweeps.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-16-17 at 01:38 AM.
  Reply With Quote
05-16-17, 08:36 AM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
I deleted an addon several weeks ago using the Twitch-branded Curse Client and it asked me about the saved variables as usual. I may have to double check if they were actually deleted or something very recently changed.
  Reply With Quote
05-16-17, 03:33 PM   #4
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
The " Curse Client" never did delete ALL saved variables. If the addon created SV's per character, also, the Client never deleted them. It was pretty good otherwise. I don't know anything at all about the Twitch Client as my computer got fried in late August of last year (2016) and I don't know when I'll have the resources to replace it.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote
05-16-17, 10:24 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I wrote this Windows Command script a long time ago to get rid of extraneous backup files and abandoned saved variables.

Code:
@echo off
pushd "C:\Program Files (x86)\World of Warcraft\WTF\Account"

del /s *.bak
del /s *.old

for /d %%i in (*) do (
	if exist %%i\SavedVariables\ (
		echo Account: %%i

		for %%j in ("%%i\SavedVariables\*.lua") do (
			echo %%~nj | findstr /r /i "^Blizzard_" > nul
			if errorlevel 1 (
				echo GlobalSV: %%~nj
				if not exist ..\..\Interface\AddOns\%%~nj\ (
					echo Delete: %%~nj
					del "%%j"
				)
			)
		)

		for /d %%j in ("%%i\*") do (
			for /d %%k in ("%%j\*") do (
				echo Character: %%k
				for %%l in ("%%k\SavedVariables\*.lua") do (
					echo %%~nl | findstr /r /i "^Blizzard_" > nul
					if errorlevel 1 (
						echo CharSV: %%~nl
						if not exist ..\..\Interface\AddOns\%%~nl\ (
							echo Delete: %%~nl
							del "%%l"
						)
					)
				)
			)
		)
	)
)

popd
pause
It scans through the SavedVar directories and checks if each Lua file has a matching addon folder name. If it doesn't, the file is deleted.
Make sure the initial pushd is pointing to your WoW account directory. The path I used is the default.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-17-17 at 10:14 AM.
  Reply With Quote
05-16-17, 10:38 PM   #6
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
That is fantastic. Just tested it, cleaned a few files out but everything else is still there. Good work.
  Reply With Quote
05-17-17, 12:18 AM   #7
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
I agree.

This is reaaaallly fantastic

P.s.
Probably we could avoid the delete of the Blizzard related settings ?

CharSV: Blizzard_ClientSavedVariables
Delete: Blizzard_ClientSavedVariables
CharSV: Blizzard_RaidUI
Delete: Blizzard_RaidUI
CharSV: Blizzard_TimeManager
Delete: Blizzard_TimeManager

Or it is safe to delete ?
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 05-17-17 at 12:26 AM.
  Reply With Quote
05-17-17, 10:13 AM   #8
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by gmarco View Post
Probably we could avoid the delete of the Blizzard related settings ?

CharSV: Blizzard_ClientSavedVariables
Delete: Blizzard_ClientSavedVariables
CharSV: Blizzard_RaidUI
Delete: Blizzard_RaidUI
CharSV: Blizzard_TimeManager
Delete: Blizzard_TimeManager
In my experience, Blizzard keeps recreating empty folders for internal LoD addons, so they shouldn't be marked for deletion. I modified the script I posted earlier to run a regex match and skip Blizzard addons.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
05-17-17, 03:03 PM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
That looks like an old DOS script. Would I save that as something.bat or somesuch?
  Reply With Quote
05-17-17, 04:06 PM   #10
Cidrei
A Fallenroot Satyr
 
Cidrei's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 21
There's actually a utility called WoWClean on this very site that was uploaded back in 2006 that does this. I've used it for years and never had a problem with it. Also comes with the source if anyone wanted to modify/check it out.
  Reply With Quote
05-17-17, 07:54 PM   #11
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
Originally Posted by myrroddin View Post
That looks like an old DOS script. Would I save that as something.bat or somesuch?
Yes, it's just a happy little batch file.
__________________
AddonsExecutive Assistant User Configurable To-Do ListLegible Mail Choose the Font for Your Mail
  Reply With Quote
05-18-17, 07:41 AM   #12
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by myrroddin View Post
That looks like an old DOS script. Would I save that as something.bat or somesuch?
.cmd is technically the extension to use in WinNT-derived (2000, XP, and newer) systems, though .bat still works for legacy support with no real difference between them. The Windows Command interface does work a lot like DOS, but has very limited support for DOS programs.



Originally Posted by Cidrei View Post
There's actually a utility called WoWClean on this very site that was uploaded back in 2006 that does this. I've used it for years and never had a problem with it. Also comes with the source if anyone wanted to modify/check it out.
I might take a look at the source. The author commented that it has couple known issues.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-18-17 at 08:01 AM.
  Reply With Quote
06-01-17, 05:20 AM   #13
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I finally got around to using SDPhantom's script, which I modified the path to my WoW directory. It worked flawlessly, as far as I can tell.
  Reply With Quote
11-15-17, 09:20 PM   #14
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Random improvement thought for SDPhantom's script, although I have long forgotten how it would be done: is there a way to @echo which SV files were deleted?
  Reply With Quote
11-16-17, 11:01 AM   #15
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Originally Posted by myrroddin View Post
Random improvement thought for SDPhantom's script, although I have long forgotten how it would be done: is there a way to :: echo which SV files were deleted?
Do you mean you want to supress the echoing of files that were deleted? If that's the case, then change line 30 to
Code:
:: echo Delete: %%~nl
Otherwise it will print the deleted variable as It already does. Example:
Code:
CharSV: ZZZ
Delete: ZZZ
EDIT: Sorry, I'd made a mistake regarding how to prevent the "Delete: " message from showing up. @ would prevent 'echo Delete: %%~nl' from being printed on screen (which is already handled by @echo off at the start of the script). The correct prefix to prevent the output of echo in that line would be :: (similar to Lua's -- ). Fixed it above now.

Last edited by aallkkaa : 11-16-17 at 12:11 PM.
  Reply With Quote
02-11-20, 08:02 AM   #16
VXBlade
A Kobold Labourer
Join Date: Feb 2020
Posts: 1
Code in this Thread still works Great

Finally cleaned up years of add-ons I tried and deleted and tried and deleted. Over 1500 files and 40mb of useless data. Works with Retail and Classic with the respective paths entered in the first line. Thanks for this!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » How to remove unused addons lua settings

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off