(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 thereIt'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.