Skip to content
⌘ NSIS Forum Archive

Recursive Delete of Files

6 posts

stonkers#

Recursive Delete of Files

How do you delete files recursively with a wildcard?

i.e.:

rm -r *.dll

TIA,
Eric
stonkers#
This is not in the documentation, and is a compile time error when I try it. The only argument to delete is Reboot. Anyone else?
Instructor#
!include "FileFunc.nsh"
!insertmacro Locate

Section
${Locate} "C:\ftp" "/M=*.dll" "LocateCallback"

IfErrors 0 +2
MessageBox MB_OK "error"
SectionEnd

Function LocateCallback
Delete $R9

Push $0
FunctionEnd
Script used header
imadulhaq#
Hi
I used normal 'Delete', 'RemDir' functions but they don't delete my files which include dlls as well then I tried to unregister the dlls by using 'UnRegDLL' and then delete dlls. This again didn't work. Then I used your function to delete dlls but it generates error message. Can you tell me what can be the reason for this.

the error message generated is: MessageBox MB_OK "error".
Instructor#
See: "${NSISDIR}\Include\Library.nsh" and docs "Appendix B: DLL/TLB Library Setup"

Name "Output"
OutFile "Output.exe"

!include "Library.nsh"

Section
!insertmacro UnInstallLib REGDLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\dllname.dll"

IfErrors 0 +2
MessageBox MB_OK "Error"
SectionEnd