Skip to content

Latest commit

 

History

History
35 lines (29 loc) · 817 Bytes

delete-files-matching-a-pattern-using-find.md

File metadata and controls

35 lines (29 loc) · 817 Bytes
aliases category classification date date_modified draft id image links local_archive_links pinned print series tags title type
delete-files-matching-a-pattern-using-find
cli
public
2019-01-28 01:43:00 -0800
2019-01-28 01:43:00 -0800
false
20190128094300
false
false
find
delete
file
directory
pattern
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