Python script that will remove all node modules using recursion
To make the script callable from anywhere using the wipenode
command, you can follow these steps:
- Move the
wipenode.py
file to a directory that's in your system's$PATH
. For instance, you can move it to/usr/local/bin
:
cp wipenode.py /usr/local/bin
- Create a new shell script named
wipenode
in the same directory (/usr/local/bin
):
touch /usr/local/bin/wipenode
- Open the
wipenode
file in a text editor and add the following content:
#!/bin/bash
python /usr/local/bin/wipenode.py "$@"
- Save and close the
wipenode
file, and make it executable by running:
chmod +x /usr/local/bin/wipenode
Now you should be able to run the wipenode
command from anywhere in your terminal. It will execute the Python script to remove node_modules
directories.
Please note that you may need to use sudo
to move the files and make them executable, depending on the permissions of the directory you choose.