none
How do you "save" a file in the recycle bin?

    Question

  • Hello

    I need to pack some files in one single one and then save it in the recycle bin.
    In this way if the user needs to reinstate them he can do it.

    A dirty way to do this could be to save the file in a temp folder and then delete it
    but i wonder if there is a more elegant solution
    where the file can be saved directly in the bin

    cheers
    Friday, June 26, 2009 9:48 AM

Answers

  • Why would you want to abuse the Recycle bin like that? Keep in mind that not all users even use the RB. Surely there must be some other place you can cache your files.
    Mattias, C# MVP
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 11:18 AM
  • Hi marck68,

    did you try Microsoft.VisualBasic.FileIO.FileSystem.MoveFile(String, String) ?
    Mark the thread as answered if the answer helps you. This helps others who have the same problem !
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 11:16 AM
  • Try this link http://www.developerfusion.com/code/4334/send-file-to-recycle-bin-in-vb-net/
    kaymaf
    I hope this helps, if that is what you want, just mark it as answer so that we can move on
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 1:07 PM
  • My.Computer.FileSystem.DeleteFile("FilePath", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
    




    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 5:09 PM
  • My.Computer.FileSystem.DeleteFile("FilePath", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
    
    
    
    





    Hi Crazypennie,

    You can also use something like this to DELETE a file.>>

      Dim FileNameAndPath As String = "C:\Example.txt"
            System.IO.File.Delete(FileNameAndPath)
    



    Regards,

    John
    • Edited by John Anthony Oliver Tuesday, June 30, 2009 2:56 AM DELETE is the favourite word of the Cybermen too!! LOL!!
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Tuesday, June 30, 2009 2:53 AM

All replies

  • Hi marck68,

    did you try Microsoft.VisualBasic.FileIO.FileSystem.MoveFile(String, String) ?
    Mark the thread as answered if the answer helps you. This helps others who have the same problem !
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 11:16 AM
  • Why would you want to abuse the Recycle bin like that? Keep in mind that not all users even use the RB. Surely there must be some other place you can cache your files.
    Mattias, C# MVP
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 11:18 AM
  • Try this link http://www.developerfusion.com/code/4334/send-file-to-recycle-bin-in-vb-net/
    kaymaf
    I hope this helps, if that is what you want, just mark it as answer so that we can move on
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 1:07 PM
  • My.Computer.FileSystem.DeleteFile("FilePath", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
    




    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Friday, June 26, 2009 5:09 PM
  • My.Computer.FileSystem.DeleteFile("FilePath", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin)
    
    
    
    





    Hi Crazypennie,

    You can also use something like this to DELETE a file.>>

      Dim FileNameAndPath As String = "C:\Example.txt"
            System.IO.File.Delete(FileNameAndPath)
    



    Regards,

    John
    • Edited by John Anthony Oliver Tuesday, June 30, 2009 2:56 AM DELETE is the favourite word of the Cybermen too!! LOL!!
    • Marked as answer by marck68 Tuesday, June 30, 2009 5:59 AM
    Tuesday, June 30, 2009 2:53 AM