none
Get path to recycle bin, or move file into it.

    Question

  • I am either trying to get the path to the recycle bin associated with a particular path, or I just need to be able to move a file into the recycle bin.

    With regards to the latter, I have tried this:

    	String^ filePath = <some path to a file here>;
    	Windows::Storage::StorageFolder^ localFolder = Windows::Storage::ApplicationData::Current->LocalFolder;
    	Concurrency::task<Windows::Storage::StorageFile^> getFile( StorageFile::GetFileFromPathAsync( filePath ) );
    	StorageFile^ file = getFile.get();
    	file->DeleteAsync(StorageDeleteOption::Default);
    

    The file does get deleted but does not show up in the recycle bin.


    Regards, Guy

    Thursday, April 19, 2012 8:10 PM

Answers

  • Hi Guy,

    There is no direct access to the Recycle Bin from Metro style apps.

    StorageFile::DeleteAsync will delete files to the Recycle Bin based on the file's location and the system settings. Since users aren't aware of files in the ApplicationData section they don't go to the Recycle Bin but are permanently deleted. Because the only access to those files is through your app you can implement your own recycling functionality if needed

    See the StorageDeleteOptions enumeration for more details.

    --Rob

    Thursday, April 19, 2012 9:04 PM