Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Do you know any simple file restore tools or alternative function for DeleteFile?

Featured Replies

Posted

Hi guys,

another question today. So I did delete few files accidentally by using the Window function DeleteFIle in my app (just some text files to delete) and if that happens the files are gone and not find in trashcan etc. So my question is how to get them back (so simple as possible)? I tried using Recuva app I found quickly on internet what was showing some files I could not find in trashcan but not all I did delete.

Is there any other function instead of using DeleteFile what does delete the files I want BUT just moving them into trashcan only like Windows itself does?

greetz

You will need to use Shell API operations to make use of the trashcan/ recycle bin. Refer to SHFileOperationW and read through the remarks section...

Quote

When used to delete a file, SHFileOperation permanently deletes the file unless you set the FOF_ALLOWUNDO flag in the fFlags member of the SHFILEOPSTRUCT structure pointed to by lpFileOp. Setting that flag sends the file to the Recycle Bin. If you want to simply delete a file and guarantee that it is not placed in the Recycle Bin, use DeleteFile.

...or, preferably, if being used on operating systems Vista and above use IFileOperation and refer to IFileOperation::SetOperationFlags...

Quote

Note  If this method is not called, the default value used by the operation is FOF_ALLOWUNDO | FOF_NOCONFIRMMKDIR.

...also take note of FOFX_RECYCLEONDELETE flag...

Quote

Introduced in Windows 8. When a file is deleted, send it to the Recycle Bin rather than permanently deleting it.

Ted.

  • Author

Hi again,

thanks for the info Ted. Also found a MASM example proc using that function like this...

.data
fname1 db "c:\_recyclefiletest.000",0

invoke RecycleFile,ADDR fname1


RecycleFile proc pszFullPath:DWORD
LOCAL fo:SHFILEOPSTRUCT

mov fo.hwnd, NULL
mov fo.wFunc, FO_DELETE
m2m fo.pFrom, pszFullPath
mov fo.pTo, NULL
mov fo.fFlags,FOF_ALLOWUNDO
invoke SHFileOperation,ADDR fo

ret
RecycleFile endp

...so I did not test it yet but I would like to know whether I can also use same path names as I did with DeleteFile function too? Just asking because there is anything telling me using just full paths only when using this SH function. So in my case when using DeleteFile I'm using paths like this...

invoke wsprintf,addr CLIPBOARDBUFFER,chr$(".\App_Files\%s.txt"),addr Buffer
invoke DeleteFile,addr CLIPBOARDBUFFER

....which starting with .\ because I just want to delete files in specific app folder where the executable is stored. So can I keep those paths like above when using the SH function instead DeleteFile or have I to change that too?

greetz

If you mean using periods to represent current and parent directories, you need to use a full path to make use of the Recycle Bin. Without a full path it will act similar to DeleteFile, you will not be able to restore from the Recycle Bin...

Ted.

@LCF-AT  if you wanna just to recover accidentally deleted file I"d recommendUFS Explorer Professional Recovery  SW

 

 

  • Author

Hi guys,

hhmmm, sounds bad Ted. Then I need to rewrite the code again just because of using full path string.

@jackyjask

Thanks for the info but I was more looking for a more simple app what can do that just in case I did delete some files like I did using DeleteFile or manually etc. Also some free one if possible. I do remember long time ago I was using R-Studio app but can't find it anymore on my system so I think the old version had any other name (not R-studio) but I don't remember the app name to find it.

greetz

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.