Q: Find multiple files in the same directory I'm trying to find, giving a path, a list of files that have same filename but different extensions (.bak and .dwg) in the same directory. 
I have this code:
String[] FileNames = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(s => s.EndsWith(".bak") || s.EndsWith(".dwg")).ToArray();
var queryDupNames = from f in FileNames
                    group f by Path.GetFileNameWithoutExtension(f) into g
                    where g.Count() > 1                                            
                    select new { Name = g.Key, FileNames = g };

This works great to locate files with the same filename but in the whole system. I need only to obtain those that are in the same directory. 
For example:
- Dir1\filename1.bak
- Dir1\filename1.dwg
- Dir1\filename2.bak
- Dir1\filename2.dwg
- Dir1\filename3.dwg
- DiferentDir\filename1.bak
- DiferentDir\filename1.dwg
- DiferentDir\filename3.dwg

The result should be:
- Dir1\filename1.bak
- Dir1\filename1.dwg
- Dir1\filename2.bak
- Dir1\filename2.dwg
- DiferentDir\filename1.bak
- DiferentDir\filename1.dwg

But with my code, filename3 is also included due to 
g.count() > 1

it's true. It's grouping by only filename... I tried to fix with this code but I got 0 results:
String[] FileNames = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(s => s.EndsWith(".bak") || s.EndsWith(".dwg")).ToArray();
var queryDupNames = from f in FileNames
                    group f by new { path = Path.GetLongPath(f), filen = Path.GetFileNameWithoutExtension(f) } into g
                    where g.Count() > 1                                            
                    select new { Name = g.Key, FileNames = g };

Any help or clue?
Thanks

A: first find all folders.
then for each folder find all the files with same name but different extension.
something like this:
        var list = new List<string>();
        foreach (var subDirectory in Directory.EnumerateDirectories(@"C:\Temp"))
        {
            var files = Directory.EnumerateFiles(subDirectory);
            var repeated = files.Select(Path.GetFileNameWithoutExtension)
                .GroupBy(x => x)
                .Where(g => g.Count() > 1)
                .Select(y => y.Key);
            list.AddRange(repeated);
        }

tested on .net 4.6

A: System.IO.Path doesn't have a GetLongPath method. I suspect you are using an external library like AlphaFS. In any case, GetLongPath returns the full file path, not the path of the file's folder. 
The file's folder path is returned by GetDirectoryName both in System.IO and other libraries like AlphaFS. The following snippet will return only Dir1\filename1, Dir1\filename2 and DifferentDir\filename1
var files = new[]
{
    @"c:\Dir1\filename1.bak",
    @"c:\Dir1\filename1.dwg",
    @"c:\Dir1\filename2.bak",
    @"c:\Dir1\filename2.dwg",
    @"c:\Dir1\filename3.dwg",
    @"c:\DiferentDir\filename1.bak",
    @"c:\DiferentDir\filename1.dwg",
    @"c:\DiferentDir\filename3.dwg",
};

var duplicates =   from file in files
                    group file by new
                    {
                        Folder = Path.GetDirectoryName(file),
                        Name = Path.GetFileNameWithoutExtension(file)
                    } into g
                    where g.Count()>1
                    select new
                    {
                        Name = g.Key,
                        Files = g.ToArray()
                    };

