Archive: Moves all directories only


Moves all directories only
Dear all,

One of our department made a software, and we create an NSIS installer.
But due to some issue with Windows Vista and 7, they decided to move all data directories from "Program Files" to "Shared Documents". It won't be a big issue for a new installation.
But if somehow our client have already installed previous version of our software, we need to have an installer that will move all data directories from "Program Files" to "Shared Documents" while leaving all non directories in "Program Files".

Is there any way for me to do this?

I don't think either "CopyFiles" or "MoveFolder" able to tell which is directory and which is a regular file.....

edit: /FILESONLY "CopyFiles" can copy file only... but still doesn't fit my need... :(

any help appreciated.

regards,

Yoachan


It's all in the manual:
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.2


Anyway, installing program files to "Shared Documents" generally is a bad idea! :stare:

There is a reason why program files usually are installed to "Program Files" folder and why that folder has special protection.

NSIS does deal properly with UAC on Vista/Win7 systems. Just use "RequestExecutionLevel admin" or use the nice UAC plug-in.

If your software doesn't work with UAC, then it's time to fix that software. Vista is on the marked for almost 5 years now.

(Undermining the operating system's security mechanisms is not a good advertisement for your product, I think)


An app's binary files should go into $PROGRAMFILES. Configuration files on the other hand should go into $APPDATA or $LOCALAPPDATA.


Maybe I misunderstood his post :igor:

If he indeed is moving user data (configuration files) from $PROGRAMFILES to $APPDATA, then it's the correct thing to do, of course.


Well no, that's not what he said. That's just a general statement on my part. :)


@All: Thanks for your replies :)

Originally posted by MSG
It's all in the manual:
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.2
Yes, I've never thought about creating list that way. Thank you for your help :)

Originally posted by LoRd_MuldeR
Anyway, installing program files to "Shared Documents" generally is a bad idea! :stare:

There is a reason why program files usually are installed to "Program Files" folder and why that folder has special protection.

NSIS does deal properly with UAC on Vista/Win7 systems. Just use "RequestExecutionLevel admin" or use the nice UAC plug-in.

If your software doesn't work with UAC, then it's time to fix that software. Vista is on the marked for almost 5 years now.

(Undermining the operating system's security mechanisms is not a good advertisement for your product, I think)
True :)

Originally posted by MSG
An app's binary files should go into $PROGRAMFILES. Configuration files on the other hand should go into $APPDATA or $LOCALAPPDATA.
True :)

Originally posted by LoRd_MuldeR
Maybe I misunderstood his post :igor:

If he indeed is moving user data (configuration files) from $PROGRAMFILES to $APPDATA, then it's the correct thing to do, of course.
True :)

Originally posted by MSG
Well no, that's not what he said. That's just a general statement on my part. :)
True :)

well, basically I only need to move data directories out of Program Files while leaving the program's binary and executable(s) in Program Files. That's why what I need to move is only directories, and I should leave all files that scattered in InstallDir for that will be program related - non data - files.

regards,

YoChan

Have look at:
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

And:
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx

If there is no NSIS plug-in for SHFileOperation, it should be trivial to create one (with some C experience).

Otherwise the System plugin-in may give you access to that function...


I've hacked something together, that should do the job:


Section
#extract some dummy files
InitPluginsDir
SetOutPath "$PLUGINSDIR\TestDirA"
File "${NSISDIR}\Contrib\Graphics\Checks\*.*"

#move the directory
push "$PLUGINSDIR\TestDirA" #from
push "$PLUGINSDIR\Foobar\TestDirB" #to
push $HWNDPARENT #hwnd
StdUtils::SHFileMove /NOUNLOAD
pop $0 #result (OK/ABORTED/ERROR)
DetailPrint "SHFileMove: $0"

#see the result
ExecShell "explore" "$PLUGINSDIR"
SectionEnd

Update. Highly recommended (bugfixes). Now ANSI and Unicode versions and also with Example+Include files.


Yet another update. Now complete package, including source.

Wiki page:
http://nsis.sourceforge.net/StdUtils_plug-in


This is a bugfix release:

Demo should now run through under Win2k. Also added "verbose" mode.

Wiki page:
http://nsis.sourceforge.net/StdUtils_plug-in