Python copy a file 🖨️

preview_player
Показать описание
Python copy a file tutorial example explained

#python #copy #copying #file

# copyfile() = copies contents of a file
# copy() = copyfile() + permission mode + destination can be a directory
# copy2() = copy() + copies metadata (file’s creation and modification times)

import shutil

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

# copyfile() = copies contents of a file
# copy() = copyfile() + permission mode + destination can be a directory
# copy2() = copy() + copies metadata (file’s creation and modification times)

import shutil

shutil.copyfile('test.txt', 'copy.txt') #src, dst

BroCodez
Автор

thank you very much but how to add a permission to this?(I want to run this code and it says "PermissionError: [Errno 13] Permission denied:")

szymonejros
Автор

How to proceed if the folder in which I want to copy the file asks for admin permission? (win10)

PREMKUMAR-wzgq
Автор

I want to see what happens to a computer when you run a while loop on this. But Im too scared to do it to my own

johnmcclure
Автор

What if I would like to browse directories searching for a file and then copy it ?

edsonbeltranejunior
Автор

Ok but is it possible to have it copy a file content then display it on the terminal?

JoeyTeam
Автор

How could I name the new file with a variable?

jonasfrigeri
Автор

how do i copy it to the windows clipboard

ameyashetty
Автор

Hopefully I wouldn't copy my c: folder lol

HanshaniLavanya