rayc76
24th September 2009 01:00 UTC
Copying multiple files to different folders
What I want to do is something very simple (I believe):
1) I want to copy Files "A" to folder A (e.g., c:\folderA)
2) I want to copy Files "B" to folder B (e.g., c:\folderB)
The NSIS script copies, but it copying more than I want. For example,
1) In addition to copying Files A to folder A, it’s also copying Files B to folder A.
2) NSIS creates folder B and copies Files B to folder B, but it’s also putting Files A to Folder B.
I only want Files A in the Folder A and I want only Files B in the B Folder.
I have 2 Sections -- one for Files A and one for Files B.
No doubt I'm missing something about the NSIS syntax. Below is a snippet.
###### FILES A #######
!insertmacro MUI_PAGE_DIRECTORY
# this shows Install Btn
!insertmacro MUI_PAGE_INSTFILES
###### FILES B #######
!insertmacro MUI_PAGE_DIRECTORY
# this shows Install Btn
!insertmacro MUI_PAGE_INSTFILES
Then below this code I have my two Sections.
Any suggestions on how to copy only the files I want in the appropriate folders?
Thanks.
watzr
24th September 2009 05:05 UTC
As I understand you dont need to keep two sections to do this task. Instead you can follow "CopyFiles" command as follows.
;-------------------------------------------------
Name "TestForum" ; The name of the installer
OutFile "TestForum.exe" ; The file to write
Page instfiles
Section ""
CopyFiles /FILESONLY "Folder\FileA.txt" "FolderA\FileA.txt"
CopyFiles /FILESONLY "Folder\FileB.txt" "FolderB\FileB.txt"
SectionEnd
;--------------------------------------------------
For further details refer "CopyFiles" command in NSIS user manual.
rayc76
27th September 2009 05:43 UTC
Thanks for the reply. I tried the CopyFiles, but it not giving me what I want. I can meet my objective if I create run two separate NSIS script -- one to copy a set of OCXs to one folder (determined by the user) and one to copy some data files to another folder (also detemined by the user).
I was trying to combine these two actions into one NSIS script. As I mentioned in my initial response, when I do that my script copies my OCXs to the correct folder, but it also includes the data files. In addition, it copies my Data Files to its correct folder, but also includes my OCXs.
Any one out there have any suggestions. Otherwise I going use two NSIS script. This works, but not elegant, but I can't spend much more time on this. I don't like being yelled at :-) Thanks!
jpderuiter
28th September 2009 08:09 UTC
I think what you need is a second Directory page, so the user can select a folder for "Files A" and a folder for "Files B", right?
You can make a custom page with two edit boxes, one for each folder, or insert two directory pages.
For the last option, see:
http://nsis.sourceforge.net/Setting_...Directory_Page
EDIT: Sorry, that link is deprecated. But you can add a second directory page. Search the forum for some examples
noemig
6th February 2012 20:39 UTC
Copying files from one folder on the installation Directory to SysWow64 or System32
Hello,
I am trying to copy some files from the installation directory to SysWow64 or system32, depending is the OS is 32 or 64.
The code is written as :
Section "DLL"
${If} ${RunningX64}
SetOutPath "$WINDIR\SysWOW64"
DetailPrint "Installer running on 64-bit host"
File /r "DFORMD.DLL"
File /r "DFORRT.DLL"
File /r "Expsrv.dll"
File /r JETCOMP.exe
${Else}
SetOutPath "$WINDIR\System32"
File /r "DFORMD.DLL"
File /r "DFORRT.DLL"
File /r "Expsrv.dll"
File /r "JETCOMP.exe"
${EndIf}
SectionEnd
The installer is copying the entire folder that contains those DLL from the installation directory to SYSWOW64 or System32.
Can somebody give me a clue on how to solve this ?
Thanks.
noemig
MSG
7th February 2012 08:20 UTC
Edit: double
MSG
7th February 2012 08:22 UTC
noemig: Please do not ask the same question twice.
http://forums.winamp.com/showthread.php?t=341810