Reputation: 6918
i have a list of albums and photos in albums. Now i want when i delete a particular album then its photos also to be delete.The name for images of a particular album is like " if album's id is 1 so its images name should be 1_1,1_2,.. . So i have got the image name upto "1_" at the time of deletion of album. now i am confused how to delete the images which have prefix "1_". my code is
`For Each Alb_Id In Col_Alb_Ids
Dim imagefolder As String = ""
imagefolder = Server.MapPath("~/DesktopModules/Album/Images_Uploaded/")
Dim ss As String = Alb_Id & "_"
imagefolder.Contains(ss)
Dim aa As String = imagefolder + ss
If File.Exists(imagefolder.Contains(aa)) Then
File.Delete(aa)
End If`
Upvotes: 0
Views: 683
Reputation: 121
imagefolder.Contains(ss)
Dim aa As String = imagefolder + ss
If File.Exists(imagefolder.Contains(aa)) Then
File.Delete(aa)
End If
Upvotes: 0
Reputation: 46425
You can call Directory.GetFiles
passing in a wildcard for the search:
C# code
String[] albumFiles = Directory.GetFiles(imageFolder, ss + "*.*");
Upvotes: 1