Skip to main content

New answers tagged

3 votes

Deleting all files but some on Mac in Terminal

First of all, it is important to remember that it is not Terminal that executes the commands, but the shell that runs inside it. On a reasonably recently created user account on a Mac, that shell will ...
Ture Pålsson's user avatar
7 votes

Deleting all files but some on Mac in Terminal

You can use find as follows (replace one general folder [before] as necessary): find "one general folder [before]" -type f -not -iname "image-*jpg" -exec rm {} \; The option -type ...
jaume's user avatar
  • 15.2k

Top 50 recent answers are included