My logo; The letters 'pk' in a white, bold font on a purplish background.
Pranav Karawale


One Liner for rimraf that gets the job done

· By
Tagged under: snippets

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.



Comments

My website supports webmentions. This means that if you like, repost, or reply to this page via Mastodon, Twitter, etc. they will show up here.
Or if you want to, you can e-mail your thoughts about it on pranav [at] karawale [dot] in.

Likes and reposts

    Replies