O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

shutil

The shutil module is used to perform high-level file operations such as copying, removing, and renaming.

copy(src,dst)

Copies the file src to the file or directory dst, retaining file permissions. src and dst are strings.

copy2(src, dst)

Like copy(), but also copies the last access and modification times.

copyfile(src, dst)

Copies the contents of src to dst. src and dst are strings.

copyfileobj(f1, f2 [, length])

Copies all data from open file object f1 to open file object f2. length specifies a maximum buffer size to use. A negative length will attempt to copy the data entirely with one operation (that is, all data will be read as a single chunk and then written).

copymode(src, dst)

Copies the permission bits from src to dst.

copystat( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required