MichaelFlya
23rd May 2005 10:28 UTC
Delete Folder if it Starts with
I need Something that will only Delete a
Folder if it Starts with Certain Characters.
Name a Folder:
(FolderName_RestDoesntMatter)
Specify that the Folder that Starts with
the text "FolderName" Gets Deleted and
the whole Folder Gets Deleted.
This would also Help me do more than one.
(FolderName_AnotherName)
(FolderName-AndAnotherName)
(FolderName VersionNumber)
(FolderNameYetAnotherName)
All Folders Get Deleted !!!
-MichaelFlya-
Instructor
23rd May 2005 11:18 UTC
Search for directories "FolderName*" in "C:\ftp" with subdirectories and delete founded (with MessageBox).
Name "Output"
OutFile "Output.exe"
!include "FileFunc.nsh"
!insertmacro Locate
Section
${Locate} "C:\ftp" "/L=D /M=FolderName* /G=1" "LocateCallback"
IfErrors 0 +2
MessageBox MB_OK "Error"
SectionEnd
Function LocateCallback
MessageBox MB_YESNOCANCEL 'Delete "$R9"?' IDNO end IDCANCEL cancel
RMDir /r '$R9'
goto end
cancel:
StrCpy $0 StopLocate
end:
Push $0
FunctionEnd
MichaelFlya
23rd May 2005 12:52 UTC
Awesome !!! Thanks Instructor !!!!!
Works great with Folders. Is There something for Files Also?
-MichaelFlya-
Instructor
23rd May 2005 14:34 UTC
See "Locate" syntax. For files /L=F, for empty directories /L=DE ...
MichaelFlya
23rd May 2005 15:00 UTC
Thanks Instructor !!!!
That Works Great with Files...
My Next Question was going to be to ask for the
Documentation to Learn More, but.... I suddenly
had the Whim to Click that link on your Signature.
Gave me This Page.
Instructor's "functions"
I Then Found all I needed to know from this Link.
Locate
Thanks !!!!
-MichaelFlya-