sindresorhus / recycle-bin Goto Github PK
View Code? Open in Web Editor NEWMove files and folders to the Windows recycle bin
License: MIT License
Move files and folders to the Windows recycle bin
License: MIT License
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.
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.
New-Item -ItemType Directory test
# Open in VSCode
code .\test\
# Attempt to remove
recycle-bin .\test\
Get-Item .\test\ # Untouched, no error message
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.