Is there an easy way to go through an entire directory recursively to find all CSV files? In python, there's os.walk and I see that Java has FileVisitor, but I have no idea how to use it correctly (

What I want to do is something like this (pseudocode):

mainDirectory = r'C:\Downloads\MyFolder'
// Must work for directories within mainDirectory
for (file : mainDirectory){
    if (filename.find('csv') > -1){

Can someone help me convert this into actual Java code? Thanks a lot!

for example

for (int i = 0, n = file; i < n; i++) {
   if (file[i].toString().contains(".cvs")) {...