Thread: Restoring deleted files

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    130

    Restoring deleted files

    Hi all,

    Is there any windows API that helps in restoring deleted files?

  2. #2
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    calling a shell command to 'undelete' them ? other than that I didnt find anything but a callback function for notification when a fiel was being undeleted - UndeleteFile

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I would start with the function
    SHGetKnownFolderIDList (FOLDERID_RecycleBinFolder ...)
    And see want can I do with the contents of the folder...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    130
    Can anybody provide me with some examples of using:

    1. SHGetKnownFolderIDList
    2. UnDeleteFile

    I have read the documentation and I think for any newbie in win-programming it will not be enough.

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    I just threw this together, nothing fancy, and not tested...
    Code:
    // Stuff...
    #define Report(x) MessageBox(NULL,x,"Report:",MB_ICONINFORMATION|MB_OK)
    char szPath[260];
    strcpy(szPath, "C:\\test.txt");
    // Delete file...
    if(0 != DeleteFile(szPath))
    Report("File deleted.");
    else
    Report("Deletation of file failed.");
    // Restore file...
    if(IDOK == UndeleteFile(szPath))
    Report("File undeleted.");
    else
    Report("Restoration of file failed.");

  6. #6
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    uh... did you even look at the posts above/MSDN?
    As Abach said, it is a callback function for the File Manager and has two arguments (none of which are "szPath" or anything even remotely close to what you suggested above).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  2. Working with muliple source files
    By Swarvy in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2008, 08:36 AM
  3. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 08:44 AM
  4. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  5. I deleted .cpp files. ARRGGHH
    By ihsir in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-14-2002, 12:49 AM