Forum Discussion

mswathi's avatar
14 years ago

How to access Recycle Bin path through the code.

Hi,



I need to check for folder exists in Recycle Bin.For that i need to give the folder path.i.e Recycle Bin Path folder path .

My question is how i can get the Recycle Bin folder path?



Please let me know if anybody know answer for this query.



Thanks&Regards

M.Swathi

1 Reply

  • Hi,


    To get the Recycle Bin path from script, you can try to call the SHGetSpecialFolderPath function from shell32.dll. For sample code of calling routines from the shell32 dynamic link library, please see http://smartbear.com/support/viewarticle.aspx?aid=9009.


    To check whether the needed folders exist in Recycle Bin, you can also use the following code:




    Const RECYCLE_BIN = &HA

    Set oShell = Sys.OleObject("Shell.Application")

    Set items = oShell.Namespace(RECYCLE_BIN).Items()

    For Each Item In Items

        If Item.IsFolder Then

          Set objFolder = Item.GetFolder

          Log.Message objFolder.Title

        End If

      Next

    End Sub