Skip to content

Turn shutil into a runnable module #126562

@zhihaoy

Description

@zhihaoy

Feature or enhancement

Proposal:

Introduction

py -m shutil copy2 ~/my/src.txt .

I often find it necessary to use some shutil functionalities in scripts. It does the right thing efficiently, has more precise error handling than cmake -E, and, most importantly, is cross-platform.

Precedent

The zipfile module can be used by py -m zipfile. It gains credits for being a cross-platform ZIP64 decompressor.

Details

  • The subcommands should cover copyfile, copystat, copy, copy2, copytree, rmtree, move, chown, which, make_archive, and unpack_archive;
  • The keyword arguments that are easy to represent in cmdline should be adapted into --kw arg cmdline options; flags can follow the style --follow_symlinks and --no-follow_symlinks.
  • It would be even nicer if combined with a progress bar (See also: Add a basic progressbar implementation to shutil)

Links

DPO: https://discuss.python.org/t/turn-shutil-into-a-runnable-module/70503

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions