Reputation: 401
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
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
Reputation: 171
IPFS is based on Merkle tree, so you can display all elements under your root resource. You can use:
http://localhost:8080/ipfs/<your_root_resource_hash>
https://ipfs.io/ipfs/QmNZiPk974vDsPmQii3YbrMKfi12KTSNM7XMiYyiea4VYZ/example#/ipfs/QmRFTtbyEp3UaT67ByYW299Suw7HKKnWK6NJMdNFzDjYdX/graphmd/README.md
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