Eric
Eric

Reputation: 141

Is There a Winapi way to Move a File to The Recycling Bin?

I've looking into a lot of different methods, but most of them require adding a file to System32, while I'm looking for a line that would allow you to move something to the recycle bin without anything being added to a computer, because I want something that would work on all Windows computers immediately. Rest assured that the deletion will not delete any major files and will ask for confirmation. I am thinking of using system("") in C++ to run the line.

Upvotes: 14

Views: 5178

Answers (2)

sehe
sehe

Reputation: 394044

There are a number of Recycle-Bin commandline tools mentioned here on alt.comp[1] (It even includes a fully automatic daemon that translates any file delete into 'move-to-recycle-bin')

The most popular seems to be Recycle from CmdUtils by Maddog, which is free and open source (GPL).

[1] Command line delete to recycle bin?

Upvotes: 1

user541686
user541686

Reputation: 210785

See SHFileOperation with FOF_ALLOWUNDO.

Upvotes: 16

Related Questions