Search code examples
bashfindcopysubdirectory

find certain files and copy their content into new file in bash


I want to find all the files with the same name (File.txt) in my current directory (./parent) and subdirectories (./parent/subdirectory{1..100}) and copy their content to a new file (line by line) in the parent directory. any ideas?


Solution

  • Would this work for you ?

    find . -name File.txt -exec cat {} + > full.txt