PDA

View Full Version : Copy an existing folder to a new location


Ron.Stordahl
9th September 2011, 04:59
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
9th September 2011, 05:25
Simple think would be CopyFile.


CopyFiles /SILENT "SourceDir\*.*" "DestDir\"
RMDir /r "SourceDir"

Ron.Stordahl
10th September 2011, 14:46
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
10th September 2011, 15:26
If you are going to delete the original folder, why not use Rename? Rename can move folders.

Stu