Thread: Can't delete Thumbnail Cache under Windows 7

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    42

    Question Can't delete Thumbnail Cache under Windows 7

    Hi,

    under Vista, i used to delete my Thumbnail Cache files :

    AppData\Local\Microsoft\Windows\Explorer\thumbcach e_32.db
    AppData\Local\Microsoft\Windows\Explorer\thumbcach e_96.db
    AppData\Local\Microsoft\Windows\Explorer\thumbcach e_256.db
    AppData\Local\Microsoft\Windows\Explorer\thumbcach e_1024.db
    AppData\Local\Microsoft\Windows\Explorer\thumbcach e_idx.db
    AppData\Local\Microsoft\Windows\Explorer\thumbcach e_sr.db
    with the following Code:

    Code:
    if ( !DeleteFile( filesC.Item( i ) ) )
    {
    	DWORD dwAttC = GetFileAttributes( filesC.Item( i ) );
    	dwAttC &= ~( FILE_ATTRIBUTE_READONLY );
    
    	SetFileAttributes( filesC.Item( i ), dwAttC );
    
    	DeleteFile( filesC.Item( i ) );
    }
    after restarting explorer.exe, those files are automatically regenerated.

    Under Windows 7 this is not the case, those files are not deleted or regenerated even after restarting the system.

    Am i missing something, or there is some way to notify explorer.exe to delete those files?


    Thanks in advance.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I'm guessing you need to look at the return result of DeleteFile() and generate some kind of meaningful error message.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    42
    Under Vista:

    -The first call to DeleteFile returns 0, and GetLastError returns ERROR_ACCESS_DENIED.
    -After changing the file attribute, DeleteFile returns non-zero value(success).
    -Thumbnails are regenerated automatically after restarting explorer.exe.

    Under Windows 7:

    -The first call to DeleteFile returns 0, and GetLastError returns ERROR_ACCESS_DENIED.
    -After changing the file attribute, DeleteFile returns 0, and GetLastError returns again ERROR_ACCESS_DENIED.
    -Thumbnails are not deleted or regenerated even after restarting the System.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well there you go then - you have the answer.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Under Windows 7 this is not the case, those files are not deleted or regenerated even after restarting the system.
    -Thumbnails are not deleted or regenerated even after restarting the System.
    I don't get it. If you can't delete the files in the first place, how would you know wether or not they get re-created??

    As for deleting them, try blanking out the file's security descriptor before deleting and see if it works.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proper Usage of the delete Operator
    By thetinman in forum C++ Programming
    Replies: 7
    Last Post: 04-25-2007, 11:53 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. delete and delete []
    By Lionel in forum C++ Programming
    Replies: 8
    Last Post: 05-19-2005, 01:52 PM
  5. FlashWindowEx not declared?
    By Aidman in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 02:58 AM