public static double GetSizeRecycleBin() { double size = 0; try { Shell shell = new Shell(); Folder recycleBin = shell.NameSpace(10); foreach (FolderItem2 f in recycleBin.Items()) { size += RecycleBin.GetSizeItemsInRecycleBin(f); } Marshal.FinalReleaseComObject(shell); } catch (Exception ex) { Console.WriteLine(string.Format("Error accessing the Recycle Bin: {0}", ex.Message)); } return(size); }