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?
#4
(Sep-29-2019, 07:35 PM)Larz60+ Wrote: if you use pathlib, testing if file exists is simple:
if filename.exists():
    ...

testing if the file exists is not the issue. i was just describing an example special case reason to build a tree copy. yeah, it is a poor example because cp and rsync both have options to do this, so such a script really isn't needed. what i am trying to focus on is of this were a needed case and you built such a script, when it gets down to copying each individual file, how would other python coders choose to do it? by invoking a copy command or by opening the files and reading and writing all the data?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
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,098 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