Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

PREVIOUS NEXT
Code Example
Python :: delete migrations django and start over deployment heroku 
Python :: datetime strptime format 
Python :: custom validation in django models 
Python :: sympy function definition 
Python :: convert all items in list to string python 
Python :: python list prime numbers 
Python :: shutdown flask server with request 
Python :: play sound on python 
Python :: how to add an item to a dictionary in python 
Python :: how to create a matrix using python 
Python :: python random liste 
Python :: openpyxl load file 
Python :: string formatting in python 
Python :: ImportError: dynamic module does not define module export function 
Python :: redirect in dajango 
Python :: count dictionary keys 
Python :: how to print without space in python 3 
Python :: networkx max degree node 
Python :: python loop append to dictionary 
Python :: pandas group by day 
Python :: get current module name python 
Python :: df dropna 
Python :: how to cout in python 
Python :: progressbar time in python 
Python :: count repeated characters in a string python 
Python :: date-fns difference in days 
Python :: pandas dataframe froms string 
Python :: to_csv create folder 
Python :: pdf to csv 
Python :: python dataframe row count 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =