chris_smith
chris_smith

Reputation: 11

How to copy a folder in jupyter notebook?

I can't believe this hasn't been asked before. I've googled with all queries and quotes and found no result. How the heck can I copy a folder inside jupyter notebook? Like, the whole folder, not just the path, or the files one by one, but the whole folder.

Thanks.

Upvotes: 1

Views: 10105

Answers (2)

Carlos Horn
Carlos Horn

Reputation: 1293

You can run shell commands from jupyter notebooks using the exclamation mark in front of the command, e.g.

!cp -r /path/to/src /path/to/dest

Upvotes: 1

Zheng Bowen
Zheng Bowen

Reputation: 409

You can just do it like the usual python script.

Here's a solution I found from another question:

from distutils.dir_util import copy_tree
copy_tree("/a/b/c", "/x/y/z")

How do I copy an entire directory of files into an existing directory using Python?

Upvotes: 0

Related Questions