In this article we will show you the code to find all the text files in multiple directories in ubuntu and windows. You can use the same for macos too. Use find folder1 folder2 -name "*.txt"
command in terminal to list the files.
Code Example –
[email protected]:~$ find folder1 folder2 -name "*.txt"
folder1
and folder2
are the absolute paths of two folders.
If you want to search in current working directory –
[email protected]:~$ find . -name "*.txt"