Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs files cp command help text inaccurate #4996

Closed
achingbrain opened this issue May 3, 2018 · 6 comments
Closed

ipfs files cp command help text inaccurate #4996

achingbrain opened this issue May 3, 2018 · 6 comments
Labels
good first issue Good issue for new contributors help wanted Seeking public contribution on this issue

Comments

@achingbrain
Copy link
Member

The CLI help says that ipfs files cp can be used to copy files into mfs:

$ ipfs files cp --help
USAGE
  ipfs files cp <source> <dest> - Copy files into mfs.

It doesn't seem to work like that though:

$ ipfs files cp ./my-file.txt /my-file.txt
Error: paths must start with a leading slash
@Mr0grog
Copy link
Contributor

Mr0grog commented May 3, 2018

I think what this is meant to mean (at least what I have found) is that it only copies from IPFS-at-large, not from disk:

$ ipfs files cp /ipfs/QmV5QdWAVbYCpcEspWu4tiCtVfdL9SESidLmnXLEJ82gdL /research-stuff

So if you want to copy from disk:

$ ipfs add ./my-file.txt
$ ipfs files cp /ipfs/<hash from previous command> /my-file.txt

The help text could still be clearer on that, though. I definitely tried to do what you’re describing the first time :P

@achingbrain
Copy link
Member Author

Ok, so the source can be IPFS-at-large or the existing mfs, but IPFS-at-large seems to win in the case where there's a matching path in your mfs:

$ echo 'alive' | ipfs files write --create /dog.txt
$ ipfs files cp /dog.txt /cat.txt
$ ipfs files read /cat.txt
alive
$ ipfs files stat --hash /cat.txt
QmcDam5WmvRs3ExhQrUSYdT43iERyDdVVPkmtW5L2y64h9
$ ipfs files mkdir /ipfs
$ echo 'dead' | ipfs files write --create /ipfs/QmcDam5WmvRs3ExhQrUSYdT43iERyDdVVPkmtW5L2y64h9
$ ipfs files cp /ipfs/QmcDam5WmvRs3ExhQrUSYdT43iERyDdVVPkmtW5L2y64h9 /shroedinger.txt
$ ipfs files read /shroedinger.txt

...drumroll

alive

@Mr0grog
Copy link
Contributor

Mr0grog commented May 3, 2018

Yeah, I believe that’s a known issue based on comments like this: #4602 (comment)

@nickdex
Copy link

nickdex commented Mar 27, 2020

I had to find this issue after searching quite a lot (maybe I was just unlucky) learn how to use files api 😅

@Stebalien Stebalien added good first issue Good issue for new contributors help wanted Seeking public contribution on this issue labels Mar 27, 2020
@hsanjuan
Copy link
Contributor

hsanjuan commented Apr 1, 2020

@nickdex, @achingbrain can you review: #7069 ?

Stebalien added a commit that referenced this issue Apr 2, 2020
Fix #4996: Improve help text for "ipfs files cp"
@nickdex
Copy link

nickdex commented Apr 3, 2020

@hsanjaun looks much better now, thank you.

ralendor pushed a commit to ralendor/go-ipfs that referenced this issue Jun 6, 2020
ralendor pushed a commit to ralendor/go-ipfs that referenced this issue Jun 8, 2020
ralendor pushed a commit to ralendor/go-ipfs that referenced this issue Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for new contributors help wanted Seeking public contribution on this issue
Projects
None yet
Development

No branches or pull requests

5 participants