@@ -476,42 +476,7 @@ file then shutil will silently fallback on using less efficient
476
476
copytree example
477
477
~~~~~~~~~~~~~~~~
478
478
479
- This example is the implementation of the :func: `copytree ` function, described
480
- above, with the docstring omitted. It demonstrates many of the other functions
481
- provided by this module. ::
482
-
483
- def copytree(src, dst, symlinks=False):
484
- names = os.listdir(src)
485
- os.makedirs(dst)
486
- errors = []
487
- for name in names:
488
- srcname = os.path.join(src, name)
489
- dstname = os.path.join(dst, name)
490
- try:
491
- if symlinks and os.path.islink(srcname):
492
- linkto = os.readlink(srcname)
493
- os.symlink(linkto, dstname)
494
- elif os.path.isdir(srcname):
495
- copytree(srcname, dstname, symlinks)
496
- else:
497
- copy2(srcname, dstname)
498
- # XXX What about devices, sockets etc.?
499
- except OSError as why:
500
- errors.append((srcname, dstname, str(why)))
501
- # catch the Error from the recursive copytree so that we can
502
- # continue with other files
503
- except Error as err:
504
- errors.extend(err.args[0])
505
- try:
506
- copystat(src, dst)
507
- except OSError as why:
508
- # can't copy file access times on Windows
509
- if why.winerror is None:
510
- errors.extend((src, dst, str(why)))
511
- if errors:
512
- raise Error(errors)
513
-
514
- Another example that uses the :func: `ignore_patterns ` helper::
479
+ An example that uses the :func: `ignore_patterns ` helper::
515
480
516
481
from shutil import copytree, ignore_patterns
517
482
0 commit comments