Script to delete thumbs.db and .DS_Store files


To totally unlock this section you need to Log-in


Login

The following function, with just a single parameter, the path to be scanned, will delete thumbs.db and all .DS_store folders included in the specified directory.

Dim FSO

Dim OFOLDER
dim OFILE
Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubFolders FSO.GetFOLDER("C:\")
Function ShowSubFolders(Folder)
For Each SUBFOLDER In Folder.SubFolders
Set OFOLDER = FSO.GetFOLDER(SUBFOLDER)
Set oFileCollection = OFOLDER.Files
For Each OFILE In oFileCollection
If UCase(OFILE.Name) = "THUMBS.DB" Then
OFILE.Delete
End If
Next
If ucase(SUBFOLDER.Name) = ".DS_Store" Then
SUBFOLDER.Delete
End If
ShowSubFolders SUBFOLDER
Next
End function

What is a .DS_Store file? What does a DS_Store file do?

.DS_Store files are used by Mac OS X to store folder specific metadata information. They are created in every folder that Mac OS X Finder accesses, even network volumes and external devices.

Folder level customizations are stored in the DS_Store file, things like custom icons, icon placement, icon size, window placement, list views, custom background pictures or colors, etc. DS_Store files are intended to be unobtrusive, which is why they have a . (point) in front of their name, which indicates to UNIX file systems that the file is invisible.

Avoid thumbs.db creation (Windows Vista - Windows 7 - Windows 8)

  • Click the Start button
  • Click on Control Panel
  • Click on Folder Options
  • Click on the View tab
  • Under the Files and Folders section check the button next to "Always show icons, never thumbnails"
  • Click on Apply
  • Click on OK