Skip to content
⌘ NSIS Forum Archive

rename/move (urgent)

5 posts

theblazingangel#

rename/move (urgent)

i've got a problem renaming folders.

we have several different software releases. each comes as a base 'Core' release, and then monthly update releases.

example situation:
1) core_A_may2007 is installed, and puts some files in folder_A.
2) update_A_jun2007 (for core_A) is installed and renames folder_A to folder_B.
3) core_B_may2007 is installed (to the same dir), and puts some files in folder_A.
4) update_B_jun2007 (for core_B) is installed, it tries to rename folder_A to folder_B but can't...

when the second update is installed, it needs to
1) move files to folder_B, despite whether or not the folder exists (perhaps copyfiles and rmdir would work better for this)
2) only overwrite files when newer (setoverwrite ifnewer kind of thing)

how do i do this? please help.

the only way to get around it is to include all file in the renamed dir's in the update releases and delete the dir's under the old names, but thats a lot of files and will severely increase the filesize's (talking like an additional 70MB!)...
Afrow UK#
The same question was asked here:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.


Stu
theblazingangel#
i ended up coding my own solution for this. i thought it might be helpful to others if i posted my code.
almeizer#
Hi, i got this error when trying to compile :

Error: command StrCpy not valid outside Section or Function

I'm using version 2.44. I also tried to move the StrCpy line into Section but seem other error rise :

!include: "D:\Programs\NSIS\Include\MoveFileFolder.nsh"
Function: ".MoveFolder_Locate_createDir"
Invalid command: ${If}
!include: error in script: "D:\Programs\NSIS\Include\MoveFileFolder.nsh" on line 173
Error in script "C:\Documents and Settings\Mr.J\Desktop\Installer Shield Project\example2.nsi" on line 32 -- aborting creation process

Any advice?