mbirth
Joined: 03 Oct 2005 Posts: 40 Location: DE, Berlin
|
Posted: Sun Feb 03, 2008 11:47 am Post subject: Cleanup old versions of Eclipse plugins/features |
|
|
This script searches for Eclipse under C:\Program Files and then parses all installed plugins and features for old versions. I once had 89MB of old versioned plugins which were superseded, i.e. old versions. Removing them made Eclipse startup a lot faster.
| Code: | #NoEnv
#SingleInstance
Progress b2 fm10 fs8, Locating Eclipse..., Eclipse Cleaner, AHKProgress-CleanEclipse
WinSet Transparent, 204, AHKProgress-CleanEclipse
EclipsePath := "C:\Program Files\Eclipse"
Loop %A_ProgramFiles%\eclipse.exe, 0, 1
{
SplitPath A_LoopFileLongPath, null, EclipsePath
break
}
Progress 50, Searching duplicates...
Deprecated := "_deprecated"
Dirs1 := "features"
Dirs2 := "plugins"
Dirs0 := 2
VersionFirstChar := "0123456789"
Ctr := 0
Loop %Dirs0%
{
CurDir := EclipsePath . "\" . Dirs%A_Index%
OldFile := ""
OldPlug := ""
OldVer := ""
IfNotExist %CurDir%%Deprecated%
{
FileCreateDir %CurDir%%Deprecated%
}
Loop %CurDir%\*.*, 1, 0
{
CurFile := A_LoopFileName
StringSplit FileParts, CurFile, _
CurPlug := FileParts1
CurVer := FileParts2
; wander splitted (by underscore) parts of filename to see if it's a version number
Loop %FileParts0%
{
If (A_Index < 2)
continue
CurFP := FileParts%A_Index%
IfInString VersionFirstChar, % SubStr(CurFP, 1, 1)
{
; contains a number at first pos - must be version
CurVer := FileParts%A_Index%
break
}
CurPlug .= "_" . FileParts%A_Index%
}
if (CurPlug = OldPlug)
{
Ctr++
Double%Ctr% := OldFile
FileGetAttrib FAttr, %CurDir%\%OldFile%
IfInString FAttr, D
{
FileMoveDir %CurDir%\%OldFile%, %CurDir%%Deprecated%\%OldFile%, R
}
Else
{
FileMove %CurDir%\%OldFile%, %CurDir%%Deprecated%\%OldFile%
}
}
OldFile := CurFile
OldPlug := CurPlug
OldVer := CurVer
}
}
Double0 := Ctr
Progress 100, All done.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
msg := ""
Loop %Double0%
{
CurFile := Double%A_Index%
StringLower CurFileL, CurFile
msg .= CurFile
msg .= ", "
}
Progress OFF
MsgBox Report for Eclipse located in %EclipsePath%:`n`n%Double0% files found:`n`n%msg% |
The old versions are stored in the folders featues_deprecated and plugins_deprecated.
This only works if the system returns a file listing already sorted!! (e.g. on Windows)
Have phun!
Cheers,
-mARKUS |
|