Archive: Search the hard drive For Delete


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:


plz


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


helllllllllllllllllllllppppppppppppppppppp


What exactly are you trying to do?

Stu


merci Afrow UK

I WISHING Search the hard drive For Delete File Example nsi file


Please use this:
http://babelfish.altavista.com/

Stu


1-Finds files .nsi all hard drive c:\ d:\ e:\ f:\ ....
2-delete .nsi files
3- end


helooooo..


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


no. i am for Example EXPLAINED

ok for Example .db


plz.....


:)

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

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


Plz hlp


The ; in front of the Delete means that line is commented out.

Stu


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


PLZ Example for me


HI
hellp me


plz hlp....


PLZ Example for me


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.

Comperio THANKFUL :o ;) :)