Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Send file to Recycle Bin instead of deleting permanently

Send file to Recycle Bin instead of deleting permanently

Scheduled Pinned Locked Moved C#
csharptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    In a C# application: How to delete a file in a non-permanent manner by sending it to Recycle Bin, instead of deleting it permanently? I want to do it so that the user will have the option of restoring the file from Recycle Bin if he wants to at a later time.

    C 1 Reply Last reply
    0
    • A Anonymous

      In a C# application: How to delete a file in a non-permanent manner by sending it to Recycle Bin, instead of deleting it permanently? I want to do it so that the user will have the option of restoring the file from Recycle Bin if he wants to at a later time.

      C Offline
      C Offline
      Carsten Zeumer
      wrote on last edited by
      #2

      You need the Windows Shell API for this. Use the SHFileOperation. Check out this[^] article... /cadi 24 hours is not enough

      A 1 Reply Last reply
      0
      • C Carsten Zeumer

        You need the Windows Shell API for this. Use the SHFileOperation. Check out this[^] article... /cadi 24 hours is not enough

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Thanks for reply. But, is it possible to get the "physical address" of the Recycle Bin "virtual" folder in the C# code itself, because in that I can use the File.Move method to move the file to that folder. This may be equivalent to deleting to the Recycle Bin.

        C 1 Reply Last reply
        0
        • A Anonymous

          Thanks for reply. But, is it possible to get the "physical address" of the Recycle Bin "virtual" folder in the C# code itself, because in that I can use the File.Move method to move the file to that folder. This may be equivalent to deleting to the Recycle Bin.

          C Offline
          C Offline
          Carsten Zeumer
          wrote on last edited by
          #4

          normally it is located under C:\RECYCLER\ + Some string that looks like an SID. But i think it is not recomendet to move files directly into this folder since you would override the maximum size of the recycler. This could lead to conditions where the recycler grows until it uses all the space of the HD. But since the recylcer is only available on windows you could use the shell functions. you app would work only on windows anyway. /cadi 24 hours is not enough

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups