Copy File From one Directory to Another in Python
Sep 21, 2022
Hi Dev,
Are you looking for example of Copy File From one Directory to Another in Python. step by step explain Python Copy File Example. I would like to share with you Python Copy File Shutil Example. We will use Python Copy File from a Directory to Another. follow bellow step for Python Copy File from One Location to Another.
In this example, I will give you a simple example of a copy a file from one directory to another. so let's see a simple example with output.
so let's see following examples with output:
Example
main.py
import shutil
srcFilePath = "files/image1.png"
destinationFilePath = "copyFiles/image1.png"
shutil.copyfile(srcFilePath, destinationFilePath)
print("File Copy Successfully.")
Output:
File Copy Successfully.
- Get Last 2 Digits of Number in Python Tutorial Example
- How to Sum of First and Last Digit of Number in Python?
- How to Get First and Last Digit of Number in Python?
- Get the Last Digit of Number in Python Tutorial Example
- Get the First Digit of Number in Python Tutorial Example
- How to Remove All Decimals from Number in Python?
- How to Convert String to Float with 2 Decimal Places in Python?
- How to Format Number to 2 Decimal Places in Python?