published on

One Liner for rimraf that gets the job done

I have been striving to cut down on node_modules. Most of the times, I need rimraf to delete a folder (usually public/dist/build) and to keep the project cross platform. So, here is a one-liner to delete a folder/file:

node -e "require('fs').rmSync('PATH',{recursive:true,force:true})"

Note: Replace PATH by the path to the folder/file. This works the same as rm -rf command, but cross-platform.