Find and remove specific files via the command line.

For example, on a Mac, you’ll often find .DS_Store files. To find and remove these you can run the following command to search for and remove every instance:

$ find . -type f -name ".DS_Store" -exec rm {} ;

This will find all files (-type f) called .DS_Store and execute the rm (remove) command on that set {}.

Run from the top directory and it will recurse its way into all sub directories and remove the files. This can be a dangerous command so use with caution.

You can also adapt the command to execute something else (e.g. a mv to another location for example.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Real-Time Fact Checking With Pocketsphinx and Google’s FactCheck API

KRE 3 to use Active User Balances

Adding two matrixes with different row numbers.

Communicate Between Fragments Using ViewModel

COJAM Klaytnscope Verification Notice

Payment Gateway Testing Guide: How To Test Payment Gateway Functionality

Django admin — Display time in the current timezone

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Praj Basnet

Praj Basnet

More from Medium

How to Upgrade to Ubuntu 22.04 LTS

Space Not Freed After I Delete a Large Log File

A Not-So-Technical Article About Git