Pat Cappelaere
Pat Cappelaere

Reputation: 401

How can you list all file objects loaded in IPFS?

I can add recursively a bunch of files within IPFS with $ ipfs add -r data/

How can I get a list back of all loaded file objects [in a specific directory]? Similar to aws s3 listObjects...

The ipfs file ls command does not seem to be recursive. I understand that I can call the API a thousand times but that does not seem to be very efficient.

I must be missing something here. Thanks, Pat.

Upvotes: 11

Views: 16906

Answers (4)

Brice Tchatchoua
Brice Tchatchoua

Reputation: 31

You can use this command to list all objects

ipfs files ls

Upvotes: 3

otboss
otboss

Reputation: 741

you can use the command:

ipfs filestore ls

Upvotes: 0

futpib
futpib

Reputation: 589

If you are interested in local files added with something like ipfs add -r --nocopy /files, what you want is

ipfs filestore ls

Unfortunately now this lists blocks instead of whole files, see https://github.com/ipfs/go-ipfs/issues/5293

Upvotes: 1

josselin chevalay
josselin chevalay

Reputation: 171

IPFS is based on Merkle tree, so you can display all elements under your root resource. You can use:

  • web ui: http://localhost:8080/ipfs/<your_root_resource_hash>
  • graphmd: https://ipfs.io/ipfs/QmNZiPk974vDsPmQii3YbrMKfi12KTSNM7XMiYyiea4VYZ/example#/ipfs/QmRFTtbyEp3UaT67ByYW299Suw7HKKnWK6NJMdNFzDjYdX/graphmd/README.md
  • shell commands:
    • ipfs ls <your_root_resource_hash>
    • ipfs refs -r <your_root_resource_hash>

Docs for ipfs files ls

edit : More important, your directory name is not persisted into IPFS. You can access your resource knowing its hash, the one you get when you add it with ipfs add -r <your_dir>

Upvotes: 6

Related Questions