aliases | category | classification | date | date_modified | draft | id | image | links | local_archive_links | pinned | series | tags | title | type | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
cli |
public |
2019-01-28 01:43:00 -0800 |
2019-01-28 01:43:00 -0800 |
false |
20190128094300 |
false |
false |
|
Delete files matching a pattern using find |
tech-note |
Delete all files that match a specific pattern. This is just find
with -delete
appended, so be careful!
Get your pattern working and returning the results you want before you use -delete
.
# Files & directories:
$ find <path-to-search> -name '<pattern>' #-delete
# Files only:
$ find <path-to-search> -type f -name '<pattern>' #-delete
# Directories only:
$ find <path-to-search> -type d -name '<pattern>' #-delete