my $query = 'SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(path, "\\\\", -2), "\\\\", 1) AS dir FROM files';