Thread Tools Display Modes
09-26-16, 07:34 AM   #1
Ohidosee
A Murloc Raider
 
Ohidosee's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 9
Nuking old lua files

Ok, this isn't a question about coding, but I figured this may be a good place to ask.

Is there a way, via program or something, that would delete all of my old lua files that are not associated with addons any longer?

I've had the same UI since forever. It's game thru some changes, but, bliz taking some tips from the community and authors being bad ass, some functions have been combined or became obsolete.

I still have lua files in my saved variables from probably 2+ years ago that i obviously don't need. If i ever downloaded the addon again I'd just start over at this point.

Thanks for your time!
  Reply With Quote
09-26-16, 08:32 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Given the the saved variables files are written out each time you exit the game then any that are older than the last time you played belong to addons that are no longer in use. Sort by date last modified and delete (or move elswhere for later use) the older ones.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
09-26-16, 12:34 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
If you're running Windows, I whipped up a batch file that scans your WTF folder and checks for orphaned SavedVariable files against your installed addons. It also removes all of the redundant backup files that WoW likes to create.

Bat Code:
  1. @echo off
  2. pushd "C:\Program Files (x86)\World of Warcraft\WTF\Account"
  3.  
  4. del /s *.bak
  5. del /s *.old
  6.  
  7. for /d %%i in (*) do (
  8.     if exist %%i\SavedVariables\ (
  9.         echo Account: %%i
  10.  
  11.         for %%j in ("%%i\SavedVariables\*.lua") do (
  12.             echo GlobalSV: %%~nj
  13.             if not exist ..\..\Interface\AddOns\%%~nj\ (
  14.                 echo Delete: %%~nj
  15.                 del "%%j"
  16.             )
  17.         )
  18.  
  19.         for /d %%j in ("%%i\*") do (
  20.             for /d %%k in ("%%j\*") do (
  21.                 echo Character: %%k
  22.                 for %%l in ("%%k\SavedVariables\*.lua") do (
  23.                     echo CharSV: %%~nl
  24.                     if not exist ..\..\Interface\AddOns\%%~nl\ (
  25.                         echo Delete: %%~nl
  26.                         del "%%l"
  27.                     )
  28.                 )
  29.             )
  30.         )
  31.     )
  32. )
  33.  
  34. popd
  35. pause

Just copy/paste this into a text file, make sure the path in line 2 matches where your WoW account folder is located, and change the extension to .bat or .cmd, both do the same thing. If you want to leave the redundant backup files alone, remove lines 4 and 5. You can delete the echo lines if you want. I like my batch files to be verbose so I know it's doing its job.
__________________
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 : 09-26-16 at 12:47 PM.
  Reply With Quote
09-26-16, 12:58 PM   #4
Ohidosee
A Murloc Raider
 
Ohidosee's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 9
Originally Posted by Fizzlemizz View Post
Given the the saved variables files are written out each time you exit the game then any that are older than the last time you played belong to addons that are no longer in use. Sort by date last modified and delete (or move elswhere for later use) the older ones.
Didn't even think of that, thanks ! Sometimes the most obvious solutions have to smack me in the face for me to see it.
  Reply With Quote
09-26-16, 12:59 PM   #5
Ohidosee
A Murloc Raider
 
Ohidosee's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 9
Originally Posted by SDPhantom View Post
If you're running Windows, ....
Thanks SDPhantom, I'll give this a shot, too!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Nuking old lua files


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