Python Forum
how would you copy a file?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how would you copy a file?
#14
(Oct-01-2019, 06:52 PM)Skaperen Wrote: do you remember how you learned that shutil was the best way to copy a file?
shutil has been in Python standard library for very long time,think since Python 1.4.
(Oct-01-2019, 06:52 PM)Skaperen Wrote: the name shutil seems like it mean "shell utilities". since i don't consider copying a file to be a shell function, i would not expect it to be in there
It's build looking at how UNIX/Linux based systems dos it.
shutil.copy() is comparable to the cp command in UNIX based systems.
Can call cp a Linux shell command as many do,so shell utilities(shutil) is not so bad,but the name could have been better.

Quote:shutil.copytree() does not fulfill my recent needs, because it requires the destination tree to not exit.
In many case when is not a simple requirement,need to combine shutil with eg os,pathlib, catch the error(try-expect) do something else.
Search for solution's.
Reply


Messages In This Thread
how would you copy a file? - by Skaperen - Sep-29-2019, 06:54 PM
RE: how would you copy a file? - by Larz60+ - Sep-29-2019, 07:35 PM
RE: how would you copy a file? - by Skaperen - Sep-30-2019, 04:30 AM
RE: how would you copy a file? - by Gribouillis - Sep-29-2019, 09:50 PM
RE: how would you copy a file? - by wavic - Sep-30-2019, 02:45 PM
RE: how would you copy a file? - by Larz60+ - Sep-30-2019, 03:14 PM
RE: how would you copy a file? - by wavic - Sep-30-2019, 10:03 PM
RE: how would you copy a file? - by buran - Sep-30-2019, 03:24 PM
RE: how would you copy a file? - by Skaperen - Oct-01-2019, 05:34 AM
RE: how would you copy a file? - by Gribouillis - Oct-01-2019, 06:10 AM
RE: how would you copy a file? - by snippsat - Oct-01-2019, 09:47 AM
RE: how would you copy a file? - by Skaperen - Oct-01-2019, 06:52 PM
RE: how would you copy a file? - by Skaperen - Oct-01-2019, 08:36 PM
RE: how would you copy a file? - by snippsat - Oct-01-2019, 10:37 PM
RE: how would you copy a file? - by Gribouillis - Oct-01-2019, 11:14 PM
RE: how would you copy a file? - by Skaperen - Oct-04-2019, 05:53 AM
RE: how would you copy a file? - by Gribouillis - Oct-04-2019, 06:06 AM
RE: how would you copy a file? - by Skaperen - Oct-04-2019, 07:15 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  best way to copy a big binary file Skaperen 15 9,256 Sep-06-2019, 09:00 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020