MoveFile Table & MoveFiles Action
Hello Experts!
I am trying to copy and move files from source loc to destination using MoveFile table but the process which i follow to do so is unsuccessful, so kindly suggest.
Task: Copying file abc.htm from Program Files\ABC Folder to Program Files\ABC\Copy.
Procees followed:
->Creating a row in MoveFile table with the following details:
FileKey: Move1
Component_: MoveFile (Created a empty component)
SourceName: abc.htm
DestName: (The field was left blank)
SourceFolder: INSTALLDIR1 (which gets resolved to Program Files\ABC)
DestFolder: Copy (which gets resolved to Program Files\ABC\Copy)
Options: 0 or 1
Position of standard action"MoveFiles": Not changed
** INSTALLDIR1 and Copy are the directory names fetched from directory table.
Even relocated the position of MoveFiles standard action(placing it after InstallFiles) couldnt solved the issue.
**Note: The Task needs to achieved using MoveFile table and not using any custom action.
Thanks- wancsho
Comments 14 Comments • Jump to latest comment
Did you assign the Component to a feature?
MoveFiles is used for files that do already exist on the target machine ... this is the case?
If you want to copy installed files, i recommend using the DuplicateFile table.
@Mistral:
Yes, the component is part of the feature.
The abc.htm is part of the msi, which means i need to copy the file installed by the MSI.
Thanks- wancsho
Does the target "Copy" folder exist? If not, you need to ensure you add it to the CreateFolder list.
Looking at the MoveFile table definition:
Primary key that uniquely identifies a particular MoveFile record.
External key into the Component table. If the component referenced by this key is not selected for installation or removal, then no action is taken on this MoveFile entry.
This column contains the localizable name of the source files to be moved or copied. This column may be left blank. See the description of the SourceFolder column. This field must contain a long file name and may contain wildcard characters (* and ?).
This column contains the localizable name to be given to the original file after it is moved or copied. If this field is blank, then the destination file is given the same name as the source file.
This column contains the name of a property having a value that resolves to the full path to the source directory. If the SourceName column is left blank, then the property named in the SourceFolder column is assumed to contain the full path to the source file itself (including the file name).
The name of a property whose value resolves to the full path to the destination directory.
I have highlighted the points you need to check. Create a verbose installation log and check that the PROPERTY values you are specifying in the source and destination columns actually exist. The log shows property values at different points in the install. As a test, you could hard code property values into the property table and see if this makes a difference. Also, make sure that the component you are using is actually associated with a feature that is getting installed, and check what key path has been set for this component. If the component is not getting installed for ANY reason, then the movefiles action will not happen.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
@EdT:
Checked again and still not working. Even checked with putting hardcoded enteries for DestFolder and SourceFolder:( Find the attached .log file of the installation.
Thanks- wancsho
Why you are not using the DuplicateFile table? It was made for this.
MoveFile is not designed to copy/move installed files.
If you think about it, Mistral is absolutely right. The MoveFiles action returns 0 which means it completed successfully, but of course there is nothing for it to do.
When InstallInitialize is reached, Windows Installer evaluates each action to see if it is immediate or deferred, and it executes immediate actions immediately, but deferred actions are evaluated and added to the script queue. The MoveFiles action, which is deferred, is evaluated and the files to be moved are checked. In your case the files are not present (as they have not been installed yet) so the action has nothing to do. When InstallFinalize is reached, the deferred script queue is executed in sequence and system changes are made. Since there was no file to be moved/copied, the action does not need to do anything, and this is what you are seeing. The experience with hard coding the paths just confirms that the MoveFiles action is not the right one for the job.
The DuplicateFile table exists specifically to allow you to install the same file into two or more different locations - it was designed to make MSI files more efficient and avoid duplication of component contents.
The only caveat is that if the "primary" file instance is not installed then the duplicates are not installed either, so you need to make sure that the component holding the primary file is always installed.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
I don't know but I have never been able to use the Duplicate file. I know the concepts, but I was trying to implement in one of the packages and it does not copy the file.
Piyush Nasa Altiris Certified Professional (ACP)
http://msiworld.blogspot.com/
We are using it successfully for years.
Would need to see how you are implementing it. Like Mistral, I have been using it for years successfully.
You need to remember that the duplicate file does not get installed if the "master" file is not installed for any reason. The target folder needs to exist also.
I documented it as part of a self healing process where the source files are installed under the app's program files folder and the destination is the user profile, and the files are automatically copied to the user profile when an advertised entry point is triggered. I have found the text of the instructions and these are reproduced below in case you want to give it a try:
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Thank you so much.. I will try this and let you know.
Cheers,
Piyush
Piyush Nasa Altiris Certified Professional (ACP)
http://msiworld.blogspot.com/
I might be wrong, but i think the decision if a file will be moved, or copied is even taken between CostInitialize and CostFinalize.
You may well be right - the costing process has to establish whether the target volume(s) have sufficient space to allow the installation so it needs to work out what will actually need installing or moving around.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
#Finally MoveFile table can be used to copy file#
Tried once and It worked but tried again it didnt and now after a long time it worked again:
MoveFileTable: Copying file from current directory(where MSI file is present) to INSTALLDIR.
1. Added the standard action ResolveSource after CostFinalize in UI and Immediate mode.
2. Placed the the file Abb.vbs in current directory along with the MSI.
3. Added the following entry in MoveFile table(image below).
4. Saved the MSI and it worked.
-wancsho
What does the validation say when you change the order of this built in actions?
Would you like to reply?
Login or Register to post your comment.