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 –
akash@LAPTOP-389NRSIQ:~$ find folder1 folder2 -name "*.txt"
folder1
and folder2
are the absolute paths of two folders.
If you want to search in current working directory –
akash@LAPTOP-389NRSIQ:~$ find . -name "*.txt"