(src, dst, symlinks=True, ignore=None)
| 209 | # how-do-i-copy-an-entire-directory-of-files- |
| 210 | # into-an-existing-directory-using-pyth |
| 211 | def copytree(src, dst, symlinks=True, ignore=None): |
| 212 | if not exists(dst): |
| 213 | makedirs(dst) |
| 214 | shutil.copystat(src, dst) |
| 215 | lst = listdir(src) |
| 216 | if ignore: |
| 217 | excl = ignore(src, lst) |
| 218 | lst = [x for x in lst if x not in excl] |
| 219 | for item in lst: |
| 220 | s = join(src, item) |
| 221 | d = join(dst, item) |
| 222 | if symlinks and islink(s): |
| 223 | if lexists(d): |
| 224 | remove(d) |
| 225 | symlink(readlink(s), d) |
| 226 | elif isdir(s): |
| 227 | copytree(s, d, symlinks, ignore) |
| 228 | else: |
| 229 | shutil.copy2(s, d) |
| 230 | |
| 231 | |
| 232 | class VersionString: |
no outgoing calls
no test coverage detected