Skip to content
⌘ NSIS Forum Archive

CopyFiles not copying in sub dirs

5 posts

rmccue#

CopyFiles not copying in sub dirs

I am trying to copy all zips in all sub directories. I am using:

CopyFiles "$EXEDIR\*.zip" "$INSTDIR\"
Why isn't it working?
Also, I want to include skinning with Wansis as optional so someone can download the skinning pack, unzip it and skin away. How would I do this?
RobGrant#
You're telling it to copy all zip files in $EXEDIR to the install directory; your command doesn't mention subdirectories. Just as CopyFiles "$EXEDIR\hello.txt" "$INSTDIR\" won't try and find hello.txt in any subdirectories in $EXEDIR.

You want to use something like the Locate function, and put a CopyFiles in the callback.
Instructor#edited
Name "Output"
OutFile "Output.exe"

!include "FileFunc.nsh"
!insertmacro Locate

Section
StrCpy $R0 "C:\ftp" ;Directory copy from
StrCpy $R1 "C:\ftp2" ;Directory copy into
StrCpy $R2 "*.zip" ;Wildcard
StrLen $R3 $R0
CopyFiles /SILENT '$R0\$R2' '$R1'

${Locate} "$R0" "/L=D" "LocateCallback"

IfErrors 0 +2
MessageBox MB_OK 'error'
SectionEnd

Function LocateCallback
StrCpy $1 $R8 '' $R3
CreateDirectory '$R1$1\$R7'
CopyFiles /SILENT '$R9\$R2' '$R1$1\$R7'

Push $0
FunctionEnd