GithubHelp home page GithubHelp logo

recycle-bin's Introduction

recycle-bin

Move files and folders to the Windows recycle bin

Install

Download the binary and put it somewhere in your %path%.

Usage

$ recycle-bin --help

Usage: recycle-bin <path> [...]

Build

Install MinGW-w64 and run:

$ build

Related

recycle-bin's People

Contributors

kidonng avatar medusalix avatar qix- avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

recycle-bin's Issues

Fails silently when attempting to remove in-use directory

If I run recycle-bin on a directory that is open elsewhere e.g. in an IDE, it will fail to do so but without any error output.

Repro (PowerShell)

New-Item -ItemType Directory test
# Open in VSCode
code .\test\
# Attempt to remove
recycle-bin .\test\
Get-Item .\test\ # Untouched, no error message

By default, don't permanently delete when recycle bin doesn't exist

I think that's a better default. We can add a flag to get back the old behavior.

It seems like we can use the FOF_WANTNUKEWARNING flag for this:

Send a warning if a file or folder is being destroyed during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION. - https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ifileoperation-setoperationflags

It's not immediately clear what they mean by warning and how we could check for that though.

Use the newer IFileOperation interface

Issuehunt badges

From the SHFileOperation docs:

This function has been replaced in Windows Vista by IFileOperation.

I wanted to use IFileOperation initially, but couldn't find any good examples of using it in C. Most used it in C++.

Should use the IFileOperation::DeleteItems and IFileOperation::SetOperationFlags(FOFX_ADDUNDORECORD | FOFX_RECYCLEONDELETE | FOF_NOERRORUI | FOF_SILENT | FOFX_EARLYFAILURE) methods.

Switching to then newer API might add support for long paths, not really sure.
See: sindresorhus/trash#16.

We can still keep the SHFileOperation around for support for Vista and older, as the FOFX_RECYCLEONDELETE flag requires Windows 8.

Help wanted - My C skills are very much at a noobish level, so any help would be much appriciated :)

Happy to use C++ if that's what it takes. I'm just trying to keep it simple with C.

IssueHunt Summary

medusalix medusalix has been rewarded.

Sponsors (Total: $100.00)

Tips

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.