Skip to content

Instantly share code, notes, and snippets.

View freddydumont's full-sized avatar

Frédérick Morin freddydumont

View GitHub Profile
@zephraph
zephraph / clean_node_modules.sh
Last active August 21, 2024 10:16
A shell script to clean up all node_modules in projects that haven't been touched in a couple weeks.
#!/bin/bash
DAYS_SINCE_LAST_CHANGE=14 # If a project hasn't been touched in this long its node_modules will be deleted
SEARCH_PATH="./Git" # Update this to the path where your code is stored
TOTAL_BYTES_REMOVED=0
Mb=1000000
Kb=1000
node_modules=$(find $SEARCH_PATH -name "node_modules" -type d -prune)