FPWEB node_modules remover
is a simple PowerShell script designed to recursively search through a specified directory and delete all node_modules
folders and their contents, without moving them to the Recycle Bin.
- Windows 10 or 11
- PowerShell
1.0.1
- Recursively searches for
node_modules
directories. - Deletes the
node_modules
directories and their contents permanently (without moving them to the Recycle Bin). - Displays progress in the console with color-coded messages:
- RED for each directory found.
- Green for each directory successfully removed.
- Takes a directory path as a parameter for flexibility.
- Excludes the parent
node_modules
directory from the search path.
- PowerShell: The script is written in PowerShell, so you need to have PowerShell installed on your system.
- PowerShell comes pre-installed on Windows 10 and 11.
- Download or copy the script
remove_node_modules.ps1
. - Open PowerShell as an Administrator.
- Run the script with the path to the directory where you want to remove
node_modules
folders.
.\fpweb_rm.ps1 -startDirectory "C:\path\to\your\projects"
- The script will start searching for node_modules directories inside the provided path and remove them.
- The process is logged in the console with green messages for found directories and red messages for removed ones.
-startDirectory: Specifies the path where the search should begin. This is the only required parameter. If no path is provided, a default path will be used.
.\fpweb_rm.ps1 -startDirectory "C:\path\to\your\projects"
.\fpweb_rm.ps1 -startDirectory "C:\path\to\your\projects" -excludeDirectories @("dir1", "dir2")
I wish you a tasty coffee.
MIT License
Copyright (c) [2024] FingerprintWeb.pl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Author: Wojciech Zdziejowski