I have a function for deleting files that are not connected to a database anymore, but it acts weird and only works on some files. I have probably overlooked something obvious :P
' Delete unused files in ~/Originals
Dim _originals = From orig_ In myEnt.Pictures
Dim _folder As String = "~/Originals"
Dim _dir As String = Server.MapPath(_folder)
Dim ListOfPhysicalFiles As String() = Directory.GetFiles(_dir)
Dim _delete As Boolean = True
For Each physicalFile As String In ListOfPhysicalFiles
For Each databaseFile As String In _originals
databaseFile = Server.MapPath(databaseFile)
If physicalFile = databaseFile Then
_delete = False
If _delete Then
Can anyone see whats wrong here?
View Complete Post