Coder Social home page Coder Social logo

cmd-recycle's Introduction

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 :)

cmd-recycle's People

Contributors

kizzx2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.