Copy and Paste Files - Command - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Copy and Paste Files - Command (/thread-42362.html) |
Copy and Paste Files - Command - MicheliBarcello - Jun-24-2024 Good night people, I have a problem, I used the following code to copy and paste files from one folder to another import os import time import shutil origem = r"C:\Program Files\Corel\CorelDRAW Graphics Suite 2022\Programs64\Pasta2" destino = r"C:\Program Files\Corel\CorelDRAW Graphics Suite 2022\Programs64\Pasta1" def copy_files(origem, destino): os.makedirs(destino, exist_ok=True) for item in os.listdir(origem): origem_arquivo = os.path.join(origem, item) destino_arquivo = os.path.join(destino, item) if os.path.isfile(origem_arquivo): shutil.copy2(origem_arquivo, destino_arquivo) copy_files(origem, destino)but it started giving an error that I don't have permission It started out of nowhere, it always worked, but now this error has started. I haven't changed anything on my computer Could you help me find why? Thanks RE: Copy and Paste Files - Command - MicheliBarcello - Jun-24-2024 PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Corel\\CorelDRAW Graphics Suite 2022\\Programs64\..... I discovered that if I open VisualStudio with the right button and run it as administrator, this program works fine. The strange thing is that it was a .py file and it always worked, out of nowhere this afternoon this bug started RE: Copy and Paste Files - Command - rodiongork - Jun-25-2024 One thing is sure, permission errors are not usually related to python. You may want to learn how to check file/folders owners and permissions on your system. Spot the file/folder which causes troubles and carefully examine who is the owner and what permissions there are. |