Skip to content

Instantly share code, notes, and snippets.

@FirefoxMetzger
Created January 27, 2022 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FirefoxMetzger/f52285d3f5d0cda65d824d5f53f37cc2 to your computer and use it in GitHub Desktop.
Save FirefoxMetzger/f52285d3f5d0cda65d824d5f53f37cc2 to your computer and use it in GitHub Desktop.
copy a single GH folder using fsspec
import fsspec
from pathlib import Path
# flat copy
destination = Path.home() / "test_folder_copy"
destination.mkdir(exist_ok=True, parents=True)
fs = fsspec.filesystem("github", org="githubtraining", repo="hellogitworld")
fs.get(fs.ls("src/"), destination.as_posix())
# recursive copy
destination = Path.home() / "test_recursive_folder_copy"
destination.mkdir(exist_ok=True, parents=True)
fs = fsspec.filesystem("github", org="githubtraining", repo="hellogitworld")
fs.get(fs.ls("src/"), destination.as_posix(), recursive=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment