The help text when running
ipfs files help cp says:
In order to add content to MFS from disk, you can use “ipfs add” to obtain the
IPFS Content Identifier and then “ipfs files cp” to copy it into MFS:
$ ipfs add --quieter --pin=false <your file> # ... # ... outputs the root CID at the end $ ipfs cp /ipfs/<CID> /your/desired/mfs/path
However, I am a bit surprised that there is not a single atomic command for performing this operation. In particular, I believe the recommended procedure has a race condition, as the file might be garbage collected before it is copied to the MFS. If I want this to work reliably, I believe I must add the file with a pin, copy it to the MFS, then remove the pin. But why not provide a single command that can accomplish this goal reliably?