oe a
oe a

Reputation: 2280

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!

Upvotes: 1

Views: 400

Answers (1)

Stephan
Stephan

Reputation: 56180

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

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

Upvotes: 3

Related Questions