IPFS files API: plans for additional commands?

Are there plans to add additional Unix-style commands to the ipfs files API? I’m primarily thinking about ipfs files cd /folder/subfolder, which would mean that ipfs files ls would then list the contents of the subfolder, not of the root directory. Vice versa, ipfs files cd / would bring you back to root.

Accordingly, it would then also need ipfs files pwd.

And is there a reason why it’s called ipfs files read, while the standard command is ipfs cat?

1 Like

Another thing we’d probably need is wildcards, e.g. ipfs files rm /path/foo*, including stuff like ^bar, baz$ etc.

Another option would be to recurse the MFS, i.e. something like ipfs files ls -l -r --files --maxdepth 2 /dir1 /dir2.

Options could be: (a) omit file listings, i.e. show directories only; (b) vice versa); © show all objects; (d) maximum recurse depth with 0=full, 1=root-only, 2=sublevel1 etc. go-ipfs would then have to output the full MFS path, not just the basename.

I have a shell alias that does that (see below), but it would be awesome to have it implemented in go-ipfs.


Another thought: in relation to the above ipfs files rm and ipfs files rm -r it would be great to have the option to auto-unpin all of the objects removed from the MFS, e.g. ipfs files rm -r -u /MFSpath. It shouldn’t unpin objects that have a copy elsewhere in the MFS. For that you should need a force-unpin option, e.g. ipfs files rm -r -u -f /MFSPath, which would then remove the other copies from the MFS as well.

Hey Jay

i’m not sure but i think we cannot rm in IPFS it’s no sense with (Web permanent and decentralize) no ?


Yeah, you can’t delete objects from the network that are already distributed. But this is about removing objects from the MFS (mutable filesystem) of the local node. The command already exists; see here: https://ipfs.io/docs/commands/#ipfs-files-rm

Currently, objects stay pinned to your node, if you remove them from the MFS, which is why you need to perform an additional ipfs pin rm command. Ergo the idea to also have an option to (force) unpin the object as well, when running ipfs files rm, not just remove it from the MFS.