FG

How to delete files on the command line with regular expressions?

Fresh3 days ago
Mar 15, 202665762 views
Confidence Score0%
0%

Problem

Lets say I have 20 files named FOOXX, where XX is the number of the file, eg 01, 02 etc. At the moment, if I want to delete all files lower than the number 10, this is easy and I just use a wildcard, eg However, if I want to delete specific files ina range, eg 13-15, this becomes more difficult. do…

Error Output

rm FOO0*

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to delete files on the command line with regular expressions?

Low Risk

In bash you can use: or to delete FOO13, FOO14 and FOO15. Bash expansions brace are documented here.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment