[Python] How do i copy files with shutil in python

Discussão em 'Python' iniciado por Stack, Agosto 26, 2025.

  1. Stack

    Stack Membro Participativo

    im trying to copy a .txt file from one dest to another. This code is running but the file isnt copying. What am i doing wrong?

    import shutil
    import os
    src = "/c:/users/mick/temp"
    src2 = "c:/users/mick"
    dst = "/c:/users/mick/newfolder1/"

    for files in src and src2:
    if files.endswith(".txt"):
    shutil.copy(files, dst)

    Continue reading...

Compartilhe esta Página