What does `shutil` give you that `os` does not?
BeginnerConceptOS, filesystem, subprocess & CLIs
Answer
High-level file operations:
shutil.copy2(src, dst)copy with metadata;copytree(src, dst, dirs_exist_ok=True).shutil.move,shutil.rmtree(path)(careful).shutil.make_archive("backup", "gztar", root_dir="/etc/app"),unpack_archive.shutil.disk_usage("/")returns total/used/free.shutil.which("kubectl")finds an executable onPATH(check before calling it).shutil.chown(path, user, group).
More on OS, filesystem, subprocess & CLIs
`os.path` vs `pathlib`: which do you use and why?BeginnerHow do you read environment variables safely?BeginnerHow do you walk a directory tree and find files?BeginnerHow do you run an external command correctly with `subprocess`?BeginnerWhy is `shell=True` dangerous, and when is it acceptable?IntermediateHow do you handle a failed command and show useful output?Intermediate