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?
#11
I think shutil has for a very long time been the preferred way to copy or move files is Python.
My answers 10-years ago(i have looked) would pretty much be the same today.
Could add pathlib to be more modern.
from pathlib import Path
from shutil import copy, move

source = Path('old_file.txt')
destination = Path('new_file.txt')
copy(source, destination)
# move(source, destination)
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,018 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