let FPath = Excel.CurrentWorkbook(){[Name="FPath"]}[Content]{0}[Column1],
FirstRow = Table.FromColumns({{FPath}}, {"Folder Path"}),
Source = Folder.Files(FPath),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Folder Path"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
Combine = Table.Combine({FirstRow, #"Removed Duplicates"}),
#"Added Custom" = Table.AddColumn(Combine, "Niestandardowe", each Table.SelectRows(Folder.Contents([Folder Path]), each [Content] is table) ),
#"Added Custom2" = Table.AddColumn(#"Added Custom", "Niestandardowe.1", each if Table.IsEmpty([Niestandardowe]) then {Text.BeforeDelimiter([Folder Path], "\", {0, RelativePosition.FromEnd})} else Table.CombineColumns([Niestandardowe], {"Folder Path", "Name"}, Combiner.CombineTextByDelimiter(""), "New")[New]),
#"Removed Other Columns1" = Table.SelectColumns(#"Added Custom2",{"Niestandardowe.1"}),
#"Expanded {0}" = Table.ExpandListColumn(#"Removed Other Columns1", "Niestandardowe.1"),
#"Removed Duplicates1" = Table.Distinct(#"Expanded {0}"),
#"Sorted Rows" = Table.Sort(#"Removed Duplicates1",{{"Niestandardowe.1", Order.Ascending}}),
#"Renamed Columns" = Table.RenameColumns(#"Sorted Rows",{{"Niestandardowe.1", "Folder Path"}}),
Custom1 = Table.Combine({FirstRow, #"Renamed Columns"})
in
Custom1