Currently i have used the following code to delete the old version directory of my application, below code works fine by finding the application with the app name. I want to find the application using it UNIQUE APPID, Can someone please help me out regarding this issue.
procedure DeleteExistingVersion(); begin   
MsgBox('Deletion Starts',mbInformation, MB_OK);
if (DirExists (ExpandConstant('{pf}\APPLICATION NAME'))) then  
begin
DelTree(ExpandConstant('{pf}\APPLICATION NAME'), True, True, True);
MsgBox('Deletion Ends', mbInformation, MB_OK);   
end; 
end;