I have 100 of folder where in each folder I have another folder with same name and inside that folder there is a .txt file which I want to extract and merge all the txt files into a new folder.
Please help me with a script in python
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityGo to the root folder of 100 sub folders and find all of the .txt files, copy them into the new folder ~/tests
:
find ./ -type f -name "*.txt" -exec cp "{}" ~/tests/ \;