How to add a list of CIDs to my IPFS node?

I have a list of CIDs (4,000 of them) that I uploaded to nft.storage and now I wish to import them to my own IPFS node. What is the easiest way to do this in bulk? I checked the ipfs add command but seems like I can only add one file (not CID) at a time.

1 Like

Create a script that calls ā€œipfs pin addā€ for each CID on your list, it will get each ā€œtreeā€ from the network and pin it locally. Now, if you have a CID that points to all your other CIDs, just pin that one instead.

1 Like

Thanks so much. You mentioned " a CID that points to all your other CIDs" and I googled it but no joy. How could I achieve that? Any reference is appreciated.

Instead of uploading a bunch of separate files or folders 1 by 1, make 1 big folder containing all of them and upload that. Youā€™ll get just 1 CID that contains it all, even if you later distribute separate CIDs for each discrete file/folder.

1 Like

Iā€™d process them one at a time using something like this, to read themā€¦

Because if you try to run the ENTIRE ā€˜importā€™ (pinning) all one operation that seems sketchy to me. Something might go wrong, or run out of resources. Iā€™d rather be doing them one at a time and also echoing each one on the command line to watch the progress.

1 Like

Wait a second, how can we know if there exists a CID that points to the other CIDs? Second question, shouldnā€™t the IPFS Desktop support ā€œmulti-importā€ instead of attacking things with scripts and workarounds? It seems a typical scenario (multiple CIDs). Have a nice weekend.

If you have the CID of the root, you can follow down all the way to the leaves simply by looking into each block and following the links. However, you cannot discover if another CID points to you.

Thatā€™s a question for the implementers; I can only tell you what exists, not why something doesnā€™t exist. Sorry.