6/9/2017 - 2:02 PM

Working with files in a C# application

Working with files in a C# application

Move file to Recyle Bin:


Folder.MoveHere Options:
using Shell32;
using System;

namespace RecycleBin
    class Program
        static void Main(string[] args)
            Type t = Type.GetTypeFromProgID("Shell.Application");
            dynamic shell = Activator.CreateInstance(t);

            Folder RecycleBin = shell.NameSpace(ShellSpecialFolderConstants.ssfBITBUCKET);  //ssfBITBUCKET is the user's recycle bin
            RecycleBin.MoveHere(@"C:\Users\dlockwood\Documents\Temporary Files\DeleteMe.txt ",new int[] { 4, 64,512,9182 });
                                                    4:          Do not display a progress dialog box
                                                    64:        Preserve undo information, if possible
                                                    512:     Do not confirm the creation of a new directory if the operation requires one to be created
                                                    9182:  Do not move connected files as a group. Only move the specified files