Python Copy File From one Directory to Another Example
Hi,
This tutorial will provide example of python copy file from one directory to another. We will use python copy file from one directory to another and rename. you can see python copy file from one location to another. We will use python copy file from a directory to another. So, let's follow few step to create example of python copy file example.
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.
You can use these examples with python3 (Python 3) version.
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.
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Python Get First Date of Last Month Example
- Python Get First Date of Next Month Example
- Python Create Zip Archive from Directory Example
- How to Check if Today is Sunday or not in Python?
- How to Check if Today is Wednesday or not in Python?
- How to Check if Today is Tuesday or not in Python?
- Python Check if Date is Weekend or Weekday Example
- Python Subtract Seconds from DateTime Example
- Python POST Request with Parameters Example
- How to Get Current Minute in Python?
- How to Get Current Hour in Python?
- How to Get Current Month in Python?