How to

delete files or folder to Recycle Bin

Published: 14. December 2008 | Updated: 21. December 2008
License: Microsoft Public License (MS-PL)
Categories: Windows, File system
Tags: C# File System Windows
Was this snippet helpful for you? YESYES / NONO
Get Analyzant!

Check your entire website from code to content in minutes with Analyzant, the free analysis suite.

Free download at

Import namespace

using Microsoft.VisualBasic.FileIO; // requires adding reference to Microsoft.VisualBasic assembly


string path = @"C:\Folder\file.txt";

FileSystem.DeleteFile(path, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
Send us feedback about this snippet »

Related Snippets: