#!/usr/bin/perl
use strict;
use Cwd;

sub walk {
    my ($workdir) = shift; 
    my ($startdir) = &cwd; # keep track of where we began 

    chdir($workdir) or die "Unable to enter dir $workdir:$!\n"; 
    opendir(DIR, ".") or die "Unable to open $workdir:$!\n"; 
    my @names = readdir(DIR) or die "Unable to read $workdir:$!\n"; 
    closedir(DIR); 

    foreach my $name (@names){ 
        next if ($name eq "."); 
        next if ($name eq ".."); 
        if (-d $name){ # is this a directory? 
            &walk($name); 
            next; 
        } 
        if ($name eq "build.gradle.kts") { 
            # is this a file named "core"? 
            print "found : $workdir/$name\n"; 
        } 
        chdir($startdir) or die "Unable to change to dir $startdir:$!\n";
    } 
}

&walk("/media/elex/UltraFit/Workspace/ELEX");