Skip to content
⌘ NSIS Forum Archive

[Locate plugin] Searching and erasing folders

2 posts

Jayme65#

[Locate plugin] Searching and erasing folders

I try to understand this scripting language and really do my best..I swear ;-)
I'm willing to check for folder named 'Test' (empty or not) then delete them.
Untill now I've succeeded to follow examples and 'list' them to a message box (don't smile..that was not so easy to me ;-))
This part is to be removed of course. What I would like to achieve is take those folder one by one and delete them...would you please help!?

RequestExecutionLevel admin
Name "LocateTest"
OutFile "LocateTest.exe"

!include "Locate.nsh"

Section "Search for text files" SearchTxt
${locate::Open} "$LOCALAPPDATA" `/L=D /N=Test /B=1` $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6

MessageBox MB_OKCANCEL '$$1 "path\name" =[$1]$\n\
$$2 "path" =[$2]$\n\
$$3 "name" =[$3]$\n\
$$4 "size" =[$4]$\n\
$$5 "time" =[$5]$\n\
$$6 "attributes =[$6]$\n\
$\n\
Find next?' IDOK loop
close:
${locate::Close} $0
${locate::Unload}
SectionEnd
Jayme65#
OK, I found the solution. Here it is for people looking for the same info:
Section "Search for directory" SearchDir
${locate::Open} "$LOCALAPPDATA" `/L=D /N=Test /B=1` $0
StrCmp $0 0 close
loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCmp $1 '' close
;MessageBox MB_OK "$1"
RMDir /r "$1"
goto loop
close:
${locate::Close} $0
${locate::Unload}
SectionEnd