Copy file to and from local
Ive perhaps missed something, and if so please do tell me, p.s this is a great package, and I really like using it.
Im trying copy a file from
- remote to local or
- local to remote
It seems like I have to use two different methods 1
fs = fsspec.open(file2).fs
fs.put(file1, file2)
and
fs = fsspec.open(file1).fs
fs.get(file1, file2)
But it would be great just to have one functions that does this. It feels a bit like local is treated slightly different than other file system.
Appolgies if Ive miss understood something,
A more typical way to get the filesystem instance is
fs = fsspec.filesystem(protocol, ...)
or
fs = fsspec.url_to_fs(path, ...)
We also have fsspec.generic, where you can make a filesystem which can do get/put for multiple backend implementations. It would be reasonable to make these one-line commands for what you want.
The trouble is, most implementations take (many) arguments, and so you have the problem of mapping URLs not just to implementations but specific configured instances. That's not too easy to solve.
But yes, "local" is somewhat special. The generic FS I mentioned above allows fo copying (cp) between any backends, but of course the bytes must pass through the memory of the process making the call.
Thank you for the advice on getting fs, appreciate that.
Yea, I understand its complicated. Ill test out fsspec.generic and see if I can simplify the code.
Thank you once again