Skip to content

Instantly share code, notes, and snippets.

@tomhopper
Last active November 10, 2022 02:55
Show Gist options
  • Select an option

  • Save tomhopper/44dde3e8788bb82a4001 to your computer and use it in GitHub Desktop.

Select an option

Save tomhopper/44dde3e8788bb82a4001 to your computer and use it in GitHub Desktop.
Use the Mac OS X terminal (UNIX command line) to find and delete all files matching a pattern
find . -name '.filename' -print -exec rm -r {} \;
# . = in current directory
# -name = file name to find
# -print = print the result's full file name to standard output
# -exec = execute the following command
# {} = fill in with the result of standard output
# \; = semicolon to terminate the -exec command, and the escape
# character so that the terminal doesn't treat the semicolon as a
# return character (used for stringing together multiple commands).
# Add '-d' to find directories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment