Table of Contents

Class RecycleBin

Namespace
WindowsRecylceBin
Assembly
WindowsRecylceBin.dll

Provides access to the Windows recycle bin and allows to restore deleted files. To create an instance of this class, use the static methods RecycleBin.ForCurrentUser() or RecycleBin.For(SecurityIdentifier sid).

public class RecycleBin : IRecycleBin
Inheritance
RecycleBin
Implements
Inherited Members

Methods

DeletePernamently(RecycleBinEntry)

Deletes the specified recycle bin entry pernamently.

public void DeletePernamently(RecycleBinEntry entry)

Parameters

entry RecycleBinEntry

The entry to delete.

Empty()

Empties the recycle bin. This will delete all entries pernamently.

public void Empty()

EnumerateEntries()

Enumerates all entries in the recycle bin.

public IEnumerable<RecycleBinEntry> EnumerateEntries()

Returns

IEnumerable<RecycleBinEntry>

For(SecurityIdentifier)

Gets the recycle bin for the specified SID.

public static RecycleBin For(SecurityIdentifier sid)

Parameters

sid SecurityIdentifier

Returns

RecycleBin

ForCurrentUser()

Gets the recycle bin for the current user.

public static RecycleBin ForCurrentUser()

Returns

RecycleBin

GetEntries()

Gets all entries in the recycle bin.

public List<RecycleBinEntry> GetEntries()

Returns

List<RecycleBinEntry>

Restore(string)

Restores the specified file or directory. If more than one matching entry is found, the entry with the most recent deletion time is restored.

public void Restore(string orginalFilePath)

Parameters

orginalFilePath string

Exceptions

IOException

Thrown when the recycle bin contains no matching entry.

Restore(RecycleBinEntry)

Restores the specified recycle bin entry.

public void Restore(RecycleBinEntry entry)

Parameters

entry RecycleBinEntry

The entry to restore.