Folder Destination Activity Delete

Hello,
I would like to know in what folder or in what location the deleted files are when using the delete activity, validate in the recycle bin and no one comes out, knows how to recover it

Hi @MICHAEL_URREGO, Welcome to the community.

This is an interesting question.

Turns out both approaches result in a file being deleted and no traces found of the files RecycleBin.

Tests

  • Deleting a file using default UiPath delete activity and it does not send the deleted file to RecycleBin
  • Deleting a file using the System.IO.File.Delete(FileName) method and it does not send the deleted file to RecycleBin either.

I am therefore suspecting that the both default UiPath Delete file activity and System.IO.File.Delete(FileName) method in c# = SHIFT+DELETE in windows.

SHIFT+DELETE does not send files to recyclebin while a normal windows Delete command does.

Related question on StackOverflow: data recovery - How can I undelete a file using C#? - Stack Overflow

2 Likes

Hi again,

I think I found out a way to delete files to recycle bin. So there are 3 possible basic approaches to delete files (probably more).

  1. UiPath Delete File acitvity - Delete (uipath.com)
  2. System.IO.File.Delete(FilePath) - File.Delete(String) Method (System.IO) | Microsoft Docs
  3. Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(FilePath, Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException) - FileSystem.DeleteFile Method (Microsoft.VisualBasic.FileIO) | Microsoft Docs

The third approach will delete your file gracefully (normal windows delete) to RecycleBin while the first two methods are similar to SHIFT+DELETE in windows.
For this to work, you will need to import the namespace Microsoft.VisualBasic.FileIO
image

Here is a demo zipfile look for a file deleteiorecycle.txt in your recycle bin after running this: DeleteFilePathToRecycleBin.zip (2.6 KB)

4 Likes

Thanks !

Hi @MICHAEL_URREGO,

Could you kindly close this thread my marking the correct answer as a solution?

This way other forum members can search easily for the solution.