Background: Customer has changed the name of the application. The application has stored files under AppData folder and now that folder needs to be copied to new name (and d
The deferred custom action copy into AppDataFolder is probably failing because you're running deferred and with the system account, so it's trying to access the user's AppDataFolder for the system account. Note that 0x80070004 is not access denied, it's "The system cannot open the file."
The immediate CA will fail because by default these CAs aren't elevated, so evidently access requires elevation.
The usual solution to this problem is to use the CopyFile element with . to copy the file from the old location to the new location, using directory definitions for those locations. If you set delete to yes it will move the files, deleting them from the old location.
As Stein points out, this really should be done by the application when the newer version first runs. Data migration really is an application issue that should be solved in the application, and not by overloading the install. Apart from the difficulty you're having, there are also potential issues if the install fails and rolls back (restoring the removed files?) and probably other unforeseen ones.