devxlogo

RecycleBinItems – Get info on the items in the Recycle Bin

RecycleBinItems – Get info on the items in the Recycle Bin

Option ExplicitPrivate Type SHQUERYRBINFO    cbSize As Long           ' bytes in this structure    i64Size As Currency      ' 64-bit integer with size of items in the Recycle                              ' Bin    i64NumItems As Currency   ' 64-bit integer with number of items in the                               ' Recycle BinEnd TypePrivate Declare Function SHQueryRecycleBin Lib "shell32.dll" Alias _    "SHQueryRecycleBinA" (ByVal pszRootPath As String, _    QueryInfo As SHQUERYRBINFO) As Long' Return number of items in the Recycle Bin for the' specified drive, or all drives if the argument is' a null string'' If you pass a second argument, it is filled with the' total size of the items in the Recycle Bin for that driveFunction RecycleBinItems(ByVal RootPath As String, _    Optional NumBytes As Currency) As Long    Dim qInfo As SHQUERYRBINFO    ' add a colon and backslash, if missing    If Len(RootPath) > 0 And Mid$(RootPath, 2, 2) <> ":" Then        RootPath = Left$(RootPath, 1) & ":"    End If    qInfo.cbSize = Len(qInfo)    Debug.Print SHQueryRecycleBin(RootPath, qInfo)    ' scale up the result    RecycleBinItems = qInfo.i64NumItems * 10000    ' return the size in the second argument    NumBytes = qInfo.i64Size * 10000End Function

See also  Comparing different methods of testing your Infrastructure-as-Code
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist