FG
💻 Software

Deleting all files that do not match a certain pattern - Windows command line

Fresh5 days ago
Mar 15, 202631527 views
Confidence Score0%
0%

Problem

Deleting items via the command-line is pretty easy. Now, suppose I want to delete all files which do not end with .jpg in a folder, how would I do that. The thing is, I have a piece of software that converts all specified images to .jpg, but it leaves the originals, which I don't need anymore. It w…

Error Output

del /options filename.extension

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Deleting all files that do not match a certain pattern - Windows command line

Low Risk

I would do it like this: This will first make all JPG files read-only, delete everything else (it will automatically skip read-only files), and then make the JPG files writeable again.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment