Link to home
Start Free TrialLog in
Avatar of davinder101
davinder101

asked on

Accessing Recycle Bin Folder Path and Files in it

Hi

I want to find the path of Recycle Bin Folder and original path of files and
folders that are in recycle bin.
or complete path of files and folders with recycle bin.


Please reply
Thanks
ASKER CERTIFIED SOLUTION
Avatar of mahesh1402
mahesh1402
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davinder101
davinder101

ASKER

HI
Here Now I am able to find the files and folders in Recycle Bin Folder, now problem is that I want to delete these files and folders from Recycle Bin,
For this either I should have the handle of files in Recycle Bin,

so Please guide me the way to access files of the Recycle Bin Folder

Please help me.
Thanks
davinder101 ,

 There is all in above project. Have a look at FillFolder()/  FillFolder2() functions. ABout deleting items from recyclebin when you right click on file list in above sample it gives you option to delete file from recyclebin. Have also look at SHEmptyRecycleBin() function.

I will suggest you to go thru full source code of above example.

MAHESH
Otherwise you may also refer function UnDelete() from above sample project.. You can Un Delete file to restore it and you may then use DeleteFile() API to permanently delete file.

MAHESH
Thanks MAHESH
Actually I through the source code of given link,
Infact what I need is to first overwrite the files which are present in Recycle Bin and then delete the file .
So the idea of SHEmptyRecycleBin() or from the source code of above sample does not fulfill my requirement.

So please tell me that how to overwrite the files that are in RECYCLE BIN.

Please Help.
Thanks
>>So please tell me that how to overwrite the files that are in RECYCLE BIN.

Create Dummy files at  same path location and move them to recycle bin. Use function SHFileOperation() to send file to recycle bin.

MAHESH
Thanks mahesh1402
As you guided I worked and now able to restore files from recycle bin to  its original location,
but now having one problem which is as follows:
Let we have files of size 700 MB in Recycle Bin Folder and its original location is D:\, now in D: there is only 200 MB free space, so what will happen if we are trying to restore such files,
also guide me to handle this problem.

Thanks
davinder,
 If we dont have enough space and when we try to move files to recycle bin folder Windows Warn us that files will be permanently deleted instead of moving them to Recycle Bin folder.

MAHESH
HI Mahesh
Actually I asked restoring of files from recycle bin to its original location.( not from original location to recycle bin)
so please tell me what will happen when restoring from recycle bin and if at original location there is not enoug space for the file.

Please reply.
Thanks

Well, I guess offcourse "There is not enough space on the disk" warning.... Because while restoring files You should have enough disk space to store restored files from recyclebin . So its good to check for enough disk space programatically and generate your own proper warning to alert user so that he will manually delete unwanted data from disk.

MAHESH
So davinder its helped ?

MAHESH