Skip to content
⌘ NSIS Forum Archive

Copy an existing folder to a new location

4 posts

Ron.Stordahl#

Copy an existing folder to a new location

I need my installer to move an existing folder on the target system to a new location on the same system. All contents including subfolders must be moved.

I believe I could do:

ExecWait '"XCOPY" "Source-Folder" "Dest-Folder" /e /i /y' 
But is there an built in command I can put in my installer to do the same thing?
hypheni9#
Simple think would be CopyFile.


CopyFiles /SILENT "SourceDir\*.*" "DestDir\"
RMDir /r "SourceDir"
Ron.Stordahl#
Thank you...it is exactly what I needed. Here is a snippet of code that I am using:

ClearErrors
${If} ${FileExists} "$0\*.*"    ;Folder $0 exists
  CreateDirectory $INSTDIR
  CopyFiles /SILENT "$0\*.*" "$INSTDIR"
  RMDir /r $0
${Else}    ;Folder $0 does not exist
  ;-----
${Endif} 
Afrow UK#
If you are going to delete the original folder, why not use Rename? Rename can move folders.

Stu