Skip to content

adminsharmasecureservicescausa/cmd-recycle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

Working with the Windows command line doesn't have to be risky! Delete multiple files to the Recycle Bin:

recycle file1 file2 supports-wildcards\*.tmp

Usage

Download the main executable; put it in %PATH%; 'nuff said...

Changelog

v0.2 - Proper exit codes when encountering error. If multiple files are given, the exit code for the last argument will be returned.

  • 0: Success
  • 1: Miscellaneous errors (such as permission)
  • 2: File/pattern not found

How does it work?

Visual Basic's FileSystem object has the DeleteFile() and DeleteDirectory() methods which both support an argument to specify deleting to the Recycle Bin. Luckily using .NET, we rolled this with C# alright.

Some more story...

Support for programmatically deleting files to the Recycle Bin is surprisingly rare. SHFileOperation used to be the only way to do it, but that Win32 API call is quite old and Microsoft said the interface has been replaced by IFileOperation. Furthermore, I found my homegrown program (using SHFileOperation) stopped working after I migrated to Windows 7 x64.

The Windows API is such a pile of stuffs. I don't know if I'm using the new endorsed IFileOperation or whatnot, but this one here using Visual Basic's FileSystem seems to work alright, so I'll just leave it at that :)

About

Delete files to Recycle Bin from Windows command line

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%