How do I move a file to the Recycle Bin using PowerShell? -


By default, when you delete a file using PowerShell, it is permanently deleted.

The items I actually delete go to the Recycle Bin as if I was through a shell removal.

How can you do it in PowerShell on a farm object?

If you do not always want to see the confirmation prompt, use the following:

< Pre> Add-Type -AssemblyName Microsoft .VisualBasic [Microsoft.VisualBasic.FileIO.FileSystem] :: DeleteFile ('D: \ foo.txt', 'ErodeSiligues Only', 'SentRroadCalbin')

(solution courtesy of resolution retirement)


Comments