Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python move all txt files

from pathlib import Path

src_path = '	mpfiles_to_move'

for each_file in Path(src_path).glob('*.*'): # grabs all files
    trg_path = each_file.parent.parent # gets the parent of the folder 
    each_file.rename(trg_path.joinpath(each_file.name)) # moves to parent folder.
Comment

PREVIOUS NEXT
Code Example
Python :: bootstrap 5 in django 
Python :: how to define an empyt dic tin python 
Python :: how to save date in cookie Python 
Python :: pytest using tempfile 
Python :: perceptron multicouche scratch python 
Python :: Block encoding request python 
Python :: password protected mongo server 
Python :: python get unicode spaces 
Python :: Alembic not finding new models 
Python :: como escribir letras griegas en python 
Python :: how do i select a range of columns by index 
Python :: split() method, sep=i, n=veces aplicado 
Python :: wexpect in python 
Python :: fetch api python 
Python :: what does << do in python 
Python :: django abstractuser fields 
Python :: string -1 python 
Python :: python string index 
Python :: signup view django 
Python :: python update function 
Python :: how to make one list from nested list 
Python :: pandas sample 
Python :: random forest 
Python :: list unpacking python 
Python :: python fme logger 
Python :: string functions 
Python :: filter dictionary python 
Python :: show which columns in dataframe have NA 
Python :: precedence in python 
Python :: step function 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =