/build/static/layout/Breadcrumb_cap_w.png

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

 


0 Comments   [ + ] Show comments

Answers (3)

Posted by: anonymous_9363 10 years ago
Red Belt
1

>Removefile table will work, if folder is empty else folder not delete

Not quite.

Removefile table will work, if folder is empty else folder not delete.  - See more at: http://www.itninja.com/question/delete-folder-after-uninstallation#sthash.FfpdA96O.dpuf

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.

how i can delete folder after i unistall the product. - See more at: http://www.itninja.com/question/delete-folder-after-uninstallation#sthash.FfpdA96O.dpuf
how i can delete folder after i unistall the product. - See more at: http://www.itninja.com/question/delete-folder-after-uninstallation#sthash.FfpdA96O.dpuf>

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 9 years ago
Posted by: Sujit J 10 years ago
Blue Belt
0

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
Posted by: vjay 10 years ago
Second Degree Blue Belt
0

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 7 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ