https://github.com/kwaytv/remove-node-modules
Simple script in go that removes node_modules in your project folders recursively
https://github.com/kwaytv/remove-node-modules
Last synced: 2 months ago
JSON representation
Simple script in go that removes node_modules in your project folders recursively
- Host: GitHub
- URL: https://github.com/kwaytv/remove-node-modules
- Owner: kWAYTV
- License: gpl-3.0
- Created: 2024-08-21T06:39:24.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-21T06:41:25.000Z (9 months ago)
- Last Synced: 2025-01-28T00:32:54.629Z (4 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Remove Node Modules Script
This Go script recursively deletes all `node_modules` directories in the current directory and its subdirectories.
## Usage
1. **Clone or download the script** to your local machine.
2. **Navigate to the directory** where the script is located using the terminal.
3. **Run the script** with the following command:
```bash
go run remove-node-modules.go
```This command will remove all `node_modules` directories found in the directory where the script is executed, including all subdirectories.
## How It Works
- The script traverses the directory tree starting from the directory where it is executed.
- For every subdirectory it finds named `node_modules`, it deletes the folder and all its contents using the `os.RemoveAll` function.
- The script skips further traversal into any `node_modules` directory after deleting it, ensuring that the removal is efficient.## Prerequisites
- **Go Programming Language**: Ensure that Go is installed on your machine. You can download it from the official [Go website](https://golang.org/).
## Warning
This script permanently deletes all `node_modules` directories and their contents within the directory from which the script is executed. Use with caution.
## License
This script is provided as-is, without any warranty. Feel free to modify and use it according to your needs.