delete folder after uninstallation...
hi all
can any one please tell me how i can delete folder after i unistall the product. its in c:/programme files/product name. can we do it without using custom action? i am working on application crystal report 2008 sp3.
please advise.
thanks
Answers (3)
>Removefile table will work, if folder is empty else folder not delete
Not quite.
http://msdn.microsoft.com/en-us/library/aa371201%28v=vs.85%29.aspx
As a fail-safe, I generally use 2 entries in the table: one to delete the files with the relevant wildcard in the 'Filename' column and one to delete the folder, with that column populated with Null.
Comments:
-
thanks all for answers. i am trying to use following vb script for custom action.
strFolderPath = "C:\Program Files (x86)\Business objects"
strFolderPath1 = "C:\Program Files\Business objects"
DeleteFolder strPath
Function DeleteFolder(strFolderPath)
Dim objFSO, objFolder
Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolderPath) Then
objFSO.DeleteFolder strFolderPath, True
End If
If objFSO.FolderExists(strFolderPath1) Then
objFSO.DeleteFolder strFolderPath1, True
End If
Set objFSO = Nothing
i followed the following route
in installshield custom actions and sequences---custom action-----new vb script----stored in custom action. in common in script execution=deferred. return processing=synchronous. install exec condition=REMOVE ALL. but dont know what should be install exec sequence. i am trying to delete a folder which left behind uninstallation.
is that correct approach?
what should be in install exec sequence? also my application gives registration error when launched at first time. how to suppress it also how to disable automatic updates?
please help.
thanks - jay25oct 10 years ago-
I know this is an older post but still may be helpful for someone in the future. You are not passing the string to the function properly.Try:
strFolderPath = "C:\Program Files (x86)\Business objects"
strFolderPath1 = "C:\Program Files\Business objects"
DeleteFolder strFolderPath
DeleteFolder strFolderPath1
Function DeleteFolder(strFolderPath)
Dim objFSO, objFolder
Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolderPath) Then
objFSO.DeleteFolder strFolderPath, True
End If
If objFSO.FolderExists(strFolderPath1) Then
objFSO.DeleteFolder strFolderPath1, True
End If
Set objFSO = Nothing - See more at: http://www.itninja.com/question/delete-folder-after-uninstallation#sthash.qN0xn5Rm.dpuf - neon_scotsman 10 years ago
hello
To remove the folder, you can use :
- RemoveFile table of the msi. (http://msdn.microsoft.com/en-us/library/aa371201(v=vs.85).aspx)
- Vb Script Custom action scheduling it after InstallFinalize with code like:
Set oFso = CreateObject("Scripting.FileSystemObject")
strFolderdelete = Session.Property("ProgramFilesFolder") & "product name"
If oFso.FolderExists(strFolderdelete) Then
oFso.DeleteFolder strFolderdelete,True
End If
Removefile table will work, if folder is empty else folder not delete.
add removefile table with all extenstion of the files (whatever files are left after uninstall). Once all files are removed from INSTALLDIR, automatically INSTALLDIR will removed.
else follow above VB script with CA.
Comments:
-
If we add emovefile table with all extenstion of the files (whatever files are left after uninstall) in the root foldder, will it delete for subfolders also?? - ur00361883 8 years ago