Search code examples
batch-filecommand-promptdosdirectory-structure

Delete all files with no name but variable extension


How do I create a batch command that will recursively go through my folders and remove all files that:

  1. Have no name before the extension

  2. The extension begins with ._

For example, ._Icon or ._Public

This script has to run on boot and preferably hides in the background but I can probably figure that out once I have a batch script.

The directory in question is D:\Dropbox

Can this be done with batch scripting or do I need something else? Thanks!


Solution

  • @echo off
    pushd d:\dropbox
    del /s ._*
    popd
    

    You can establish this .bat as a scheduled task, which will run on boot.