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

Comments

  • This content is currently hidden from public view.
    Reason: Removed by member request
    For more information, visit our FAQ's.
Please log in to comment

Community Chosen Answer

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>
Answered 01/27/2014 by: VBScab
Red Belt

  • 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
    • 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
Please log in to comment

Answers

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
Answered 01/26/2014 by: Sujit J
Blue Belt

Please log in to comment
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.

Answered 01/27/2014 by: vjay
Second Degree Blue Belt

  • 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??
Please log in to comment
This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

Answer this question or Comment on this question for clarity