- NSIS Discussion
- Search the hard drive For Delete
Archive: Search the hard drive For Delete
didava
29th May 2007 15:32 UTC
Search the hard drive For Delete File
Hi
${GetDrives} "[Option]" "Function"
"[Option]" ; [FDD+HDD+CDROM+NET+RAM]
; FDD Floppy Disk Drives
; HDD Hard Disk Drives
; CDROM CD-ROM Drives
; NET Network Drives
; RAM RAM Disk Drives
;
; [ALL]
; Find all drives by letter (default)
;
"Function" ; Callback function when found
Function "Function"
; $9 "drive letter" (a:\ c:\ ...)
; $8 "drive type" (FDD HDD ...)
; $R0-$R9 are not used (save data in them).
; ...
Push $var ; If $var="StopGetDrives" Then exit from function
FunctionEnd
for Example
${locate::Open} "j:\" "/F=1 /D=1 /S=,Kb /T=,Creation delete/M=*.nsi /SD=NAME /B=1" $R0
Search For only .nsi file for delete
THANKS:cry: :cry: :cry:
didava
29th May 2007 16:05 UTC
plz
didava
29th May 2007 16:37 UTC
plz hlp
Name "Locate"
OutFile "Locate.exe"
!include "Locate.nsh"
!include "Sections.nsh"
Page components
Page instfiles
Section "Search and write founded in text file" SearchAndWriteInFile
GetTempFileName $1
FileOpen $2 $1 w
${locate::Open} "j:\" "/M=*.nsi /L=F" $R0
loop:
${locate::Find} $R0 $R1 $R2 $R3 $R4 $R5 $R6
RMDir $R0
StrCmp $R1 '' close
StrCmp $R4 '' 0 +3
FileWrite $2 '$R1 $\r$\n'
goto +2
FileWrite $2 '@del $0 $R1 $\r$\n'
goto loop
close:
${locate::Close} $R0
${locate::Unload}
FileClose $2
Exec '"notepad.exe" "$1"'
SectionEnd
didava
29th May 2007 22:00 UTC
helllllllllllllllllllllppppppppppppppppppp
Afrow UK
29th May 2007 22:30 UTC
What exactly are you trying to do?
Stu
didava
29th May 2007 22:42 UTC
merci Afrow UK
I WISHING Search the hard drive For Delete File Example nsi file
Afrow UK
29th May 2007 22:57 UTC
Please use this:
http://babelfish.altavista.com/
Stu
didava
29th May 2007 23:06 UTC
1-Finds files .nsi all hard drive c:\ d:\ e:\ f:\ ....
2-delete .nsi files
3- end
didava
30th May 2007 00:22 UTC
helooooo..
demiller9
30th May 2007 04:20 UTC
I don't mean to offend the original poster, but I don't see a valid use for his request. If there are nsi files on the target system they should not be deleted unless you are uninstalling your own program and the nsi files were put there by your installer. In such a situation you should know where they were installed and not need to search every hard drive.
I would be furious if some installer I ran deleted all of the nsi files on my computer.
Don
didava
30th May 2007 09:45 UTC
no. i am for Example EXPLAINED
ok for Example .db
didava
30th May 2007 11:22 UTC
plz.....
Instructor
30th May 2007 11:53 UTC
:)
Name "Test"
OutFile "Test.exe"
!include "Locate.nsh"
!include "FileFunc.nsh"
!insertmacro GetDrives
Section
${GetDrives} "HDD" "GetDrivesCallback"
${locate::Unload}
SectionEnd
Function GetDrivesCallback
StrCpy $9 $9 2
${locate::Open} "$9" "/F=1 /D=0 /M=*.nsi /B=1" $0
StrCmp $0 0 close
loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCmp $1 '' close
#Your code
; Delete $1
goto loop
close:
${locate::Close} $0
Push 0
FunctionEnd
didava
30th May 2007 17:04 UTC
Thanks Instructor , I can test the code vrey good Thanks
But Never not delete file
Example
Name "Test"
OutFile "Test.exe"
!include "Locate.nsh"
!include "FileFunc.nsh"
!insertmacro GetDrives
Section
${GetDrives} "HDD" "GetDrivesCallback"
${locate::Unload}
SectionEnd
Function GetDrivesCallback
StrCpy $9 $9 2
${locate::Open} "$9" "/F=1 /D=0 /M=*.db /B=1" $0
StrCmp $0 0 close
loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCmp $1 '' close
#Your code
; Delete $1
goto loop
close:
${locate::Close} $0
Push 0
FunctionEnd
didava
30th May 2007 17:27 UTC
Plz hlp
Afrow UK
30th May 2007 17:40 UTC
The ; in front of the Delete means that line is commented out.
Stu
didava
30th May 2007 17:54 UTC
tanks
so.. plz BENEFICIAL Example .db THANKS AGAIN
Name "Test"
OutFile "Test.exe"
!include "Locate.nsh"
!include "FileFunc.nsh"
!insertmacro GetDrives
Section
${GetDrives} "HDD" "GetDrivesCallback"
${locate::Unload}
SectionEnd
Function GetDrivesCallback
StrCpy $9 $9 2
${locate::Open} "$9" "/F=1 /D=0 /M=*.db /B=1" $0
StrCmp $0 0 close
loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6
StrCmp $1 '' close
Delete $0
Delete "c:\*.db"
goto loop
close:
${locate::Close} $0
Push 0
FunctionEnd PLZ Example for me
didava
30th May 2007 18:48 UTC
PLZ Example for me
didava
30th May 2007 21:55 UTC
HI
hellp me
didava
31st May 2007 08:23 UTC
plz hlp....
didava
31st May 2007 11:59 UTC
PLZ Example for me
Comperio
31st May 2007 14:28 UTC
All your multiple posts and the whining and crying aren't going to get you answers any faster. In fact, they only serve to do the opposite!! :mad:
Instructor's post should give you what you want. However, as Afrow already stated, you need to remove the semicolon from the Delete statement. In other words, change this:
#Your code
; Delete $1
goto loop
to this:
#Your code
Delete $1
goto loop
You might also need to adjust the parameters of the search ( ${locate::Open}) in order to remove the files you want to remove.
If you are still confused, download and read the docs regarding the
Locate plugin.
didava
31st May 2007 16:57 UTC
Comperio THANKFUL :o ;) :)