Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 9th October 2004, 07:28   #1
saritha
Junior Member
 
Join Date: Jul 2004
Posts: 6
how to copy files from one dir to another with file extention.

Hi Iam writing a Installer script what it does is ……it will copy a * .p12 files from temp to config dir



Temp and config are two different dir’s , both will have not only *.p12 ,but also another files.

Temp should only copy the *.p12 files from temp to config dir and remove old *p12 files from config dir



It will work only if we know the file name. ………Without knowing the filename how to copy only specific type of file’s from one dir to another with help of file extension.

Here am writing script, which is, not work bur I want to explain you in detail.


outfile "C:\Importcert1.exe"
section Import
StrCpy $R4 ""

loop:
IfFileExists "C:\Program Files\VistaWiz\OpenVPN\temp\*.p12" config no_config


no_config:
Strcmp $R4 "counter" endall
MessageBox MB_ICONEXCLAMATION|MB_OK \
'Could not find p12 Files In temp Dir .\
$\n "Without it you cannot run " ${APPNAMEANDVERSION}". \
$\n$\n Please Extract E-Mail Attachmet Into temp Dir Then Click Importcert Link.'
goto endForGood

doDel:
StrCpy $R4 "counter"
; KillProcDLL::KillProc "openvpn-gui.exe"
delete "C:\Program Files\VistaWiz\OpenVPN\config\*.p12"

config:
KillProcDLL::KillProc "openvpn-gui.exe"
StrCmp $R4 "" doDel
CopyFiles /SILENT "C:\Program Files\VistaWiz\OpenVPN\temp\*.p12" "C:\Program Files\VistaWiz\OpenVPN\config\*.p12"
delete "C:\Program Files\VistaWiz\OpenVPN\temp\*.p12"
goto loop

endall:
SetOutPath "C:\Program Files\VistaWiz\OpenVPN\bin\"
Exec "openvpn-gui.exe"


endForGood:
sectionend

Please help p me I really appreciate
saritha is offline   Reply With Quote
Old 9th October 2004, 10:42   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
CopyFiles /SILENT "C:\Program Files\VistaWiz\OpenVPN\temp\*.p12" "C:\Program Files\VistaWiz\OpenVPN\config"


To delete all .p12 files in the temp dir, you should use FindFirst, FindNext etc:

code:
Function DeleteP12Files
Exch $R0
Push $R1
Push $R2
ClearErrors
FindFirst $R1 $R2 "$R0\*.p12"
Top:
IfErrors Done

Delete "$R0\$R2"

ClearErrors
FindNext $R1 $R2
Goto Top
Done:

FindClose $R1
Pop $R2
Pop $R1
Pop $R0
FunctionEnd



Then call the function like so:
code:
Push "C:\Program Files\VistaWiz\OpenVPN\temp"
Call DeleteP12Files


This will delete all p12 files in that directory.

-Stu
Afrow UK is offline   Reply With Quote
Old 9th October 2004, 21:08   #3
saritha
Junior Member
 
Join Date: Jul 2004
Posts: 6
Thank you very very much !
saritha is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump