Answers for "auto add extension if file copied in folder python"

1

using shutil to move files with a unique extension

import os
import shutil
sourcepath='C:/Users/kevinconnell/Desktop/Test_Folder/'
sourcefiles = os.listdir(sourcepath)
destinationpath = 'C:/Users/kevinconnell/Desktop/Test_Folder/Archive'
for file in sourcefiles:
    if file.endswith('.png'):
        shutil.move(os.path.join(sourcepath,file), os.path.join(destinationpath,file))
Posted by: Guest on June-18-2020
1

python copy file to new filename

shutil has many methods you can use. One of which is:

from shutil import copyfile
copyfile(src, dst)
Posted by: Guest on April-16-2020

Code answers related to "auto add extension if file copied in folder python"

Python Answers by Framework

Browse Popular Code Answers by Language