Python Forum
copy content of folder to existing folder
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
copy content of folder to existing folder
#1
I am trying to copy content of folder to existing folder
using following code and got 'PermissionError: [error 13] permission denied : 'c:/WINDOWS/System32'
the program is run under administrator

import shutil
import os

programSourcePath = "C:\Users\Admin\Desktop\Utilities_Installers_new\Programs"

pstoolfiles = os.listdir(programSourcePath + '/PSTools')

for name in pstoolfiles:
    srcname = os.path.join(programSourcePath + '/PSTools', name)
    dstname = os.path.join(r'c:/WINDOWS/System32', name)
    shutil.copyfile(srcname, dstname)
Thanks,
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 283 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon
  Deleting Windows temp folder Raysz 7 449 Apr-02-2024, 12:36 PM
Last Post: Raysz
  Copy xml content from webpage and save to locally without special characters Nik1811 14 963 Mar-26-2024, 09:28 AM
Last Post: Nik1811
  Help with creating folder and "virtual environment" AudunNilsen 1 248 Mar-21-2024, 04:41 AM
Last Post: deanhystad
Question How to add Python folder in Windows Registry ? Touktouk 1 277 Feb-20-2024, 01:04 PM
Last Post: DeaD_EyE
  Create dual folder on different path/drive based on the date agmoraojr 2 455 Jan-21-2024, 10:02 AM
Last Post: snippsat
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 562 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  problem in import module from other folder akbarza 5 1,439 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  Reading a file name fron a folder on my desktop Fiona 4 922 Aug-23-2023, 11:11 AM
Last Post: Axel_Erfurt
  Rename files in a folder named using windows explorer hitoxman 3 755 Aug-02-2023, 04:08 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020