Skip to Content
Python: Essential Reference, Third Edition
book

Python: Essential Reference, Third Edition

by David Beazley
February 2006
Intermediate to advanced content levelIntermediate to advanced
648 pages
14h 53m
English
Sams
Content preview from Python: Essential Reference, Third Edition

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( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python: Essential Reference

Python: Essential Reference

David M. Beazley

Publisher Resources

ISBN: 0672328623Purchase book