Last active
April 25, 2024 06:28
-
-
Save szhu/cb1a9d7bb37ccc8f785f38790c3dcc5f to your computer and use it in GitHub Desktop.
Tell Spotlight to ignore all node_modules directories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tell Spotlight to ignore all node_modules directories. | |
# Run this from the home directory. | |
# Pieced together from: | |
# - https://github.com/yarnpkg/yarn/issues/6453#issuecomment-498110933 | |
# - https://stackoverflow.com/a/4210072/782045 | |
# - https://superuser.com/a/151427/110699 | |
# - https://apple.stackexchange.com/a/258791/31413 | |
# - https://unix.stackexchange.com/a/24563/64762 | |
# This does a dry run; remove `echo` to do actually do it. | |
find . -xdev \ | |
-type d -path "./Library" -prune -o \ | |
-type d -name ".*" -prune -o \ | |
-type d -name "*.noindex" -prune -o \ | |
-type d -name 'node_modules' -prune \ | |
-exec echo mv '{}' '{}.noindex' ';' \ | |
-exec echo ln -s 'node_modules.noindex' '{}' ';' |
Author
szhu
commented
Mar 15, 2022
find . -xdev \
-type d -path "./Library/Caches" -prune -o \
-type d -path "./.npm" -prune -o \
-type d -path "./.vscode/extensions" -prune -o \
-type d -name 'node_modules' -print -prune -exec tag --add node_modules '{}' ';'
find . -xdev \
-type d -path "./Library/Caches" -prune -o \
-type d -path "./.npm" -prune -o \
-type d -path "./.vscode/extensions" -prune -o \
-type d -name 'node_modules' -prune -o \
-type d -name .parcel-cache -exec echo rm -rf -- '{}' ';'
Remove all empty folders from a Git repo:
find . -xdev \
-type d -path "./node_modules" -prune \
-type d -path "./.git" -prune \
-type d -empty \
-exec rmdir ';'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment