//flex table opened by JP

Click to See Complete Forum and Search --> : delete files and keep in recycle


jfchui
12-05-2004, 02:28 AM
Just wonder if there is anyone who knows how to write codes (VB or C++) to delete a file(s). But I don't want the file to be permanently removed. How can I make it to go to the recycle bin after it is deleted. Is that possible with codes?

Using an instance of the FileSystemObject it is a simple command to delete a file in Vb. But my test shows it does not go to the recycle bin (under Windows OS).

Thks.

ScaryBinary
12-05-2004, 09:11 AM
Looks like you have to do it using the Windows API. An example is linked below.

Recycle Bin Example (VB) (http://www.cpearson.com/excel/Recycle.htm)

ahurtt
12-09-2004, 11:43 AM
Yes, the recycle bin is a Windows specific thing so you would have to use some API provided by Windows. To do it in a more generic way, it sounds like what you are talking about is just a simple "move" command.

ScaryBinary
12-09-2004, 06:42 PM
Originally posted by ahurtt
...it sounds like what you are talking about is just a simple "move" command.
I thought that, too, but I couldn't figure out where the recycle bin actually is (in other words, how does one refer to the recycle bin in a C:/foo/bar sort of fashion?).

:confused: