Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I unpin and remove all IPFS content from my machine?

Tags:

ipfs

I've added a bunch of files via ipfs add. How do I unpin and remove all of these at once?

like image 367
jclay Avatar asked Mar 30 '17 12:03

jclay


People also ask

Can we delete file from IPFS?

IPFS does allows you to delete file, you just need to make so on all different nodes hosting the file.


2 Answers

to unpin all added content:

ipfs pin ls --type recursive | cut -d' ' -f1 | xargs -n1 ipfs pin rm

then optionally run storage garbage collection to actually remove things:

ipfs repo gc

like image 178
jclay Avatar answered Nov 16 '22 02:11

jclay


Additionally to jclay's answer, you might also want to delete everything on MFS:

ipfs files ls / | while read f; do ipfs files rm -r "/$f"; done

(Obligatory warning that this won't work if paths contain newlines.)

like image 45
Caesar Avatar answered Nov 16 '22 02:11

Caesar