Hello people,
I have made a code that generates all paths from folders and sub folders in a certain path.
the list contains like 6000 different items.
I want to remove all list items that contains "junk" or "junk2" the phrases are always the last phrase in the path for the list item example:
C:\X\blablablal\junk
C:\X\blablablal\awdasdasd\junk2
C:\X\adjassdasd\junk
Could someone help me with a code that works?Code:Dim listofstrings As New List(Of String) ' For Each d In Directory.EnumerateDirectories("X:\1 Övriga kunder\Arkiv\Originalfiler", "*.*", SearchOption.AllDirectories) For Each d In Directory.EnumerateDirectories("C:\X\", "*.*", SearchOption.AllDirectories) Dim myPath = ((d.ToString())) listofstrings.Add(myPath) 'Console.WriteLine(myPath) Next For Each Pitem In listofstrings If Pitem.Contains("junk" or "junk2") Then Pitem.Remove() End If Next End Sub
my loop doesn't work
Thank you in advance




Reply With Quote
