Answers for "move all files in directory with shutils"

0

move all files in directory with shutils

import shutil
import os
    
source_dir = '/path/to/source_folder'
target_dir = '/path/to/dest_folder'
    
file_names = os.listdir(source_dir)
    
for file_name in file_names:
    shutil.move(os.path.join(source_dir, file_name), target_dir)
Posted by: Guest on September-17-2021

Code answers related to "move all files in directory with shutils"

Python Answers by Framework

Browse Popular Code Answers by Language