Dim FilesToDelete As List
FilesToDelete.Initialize
FilesToDelete.AddAll(File.ListFiles(File.DirInternal))
For I = 0 To FilesToDelete.Size -1
File.Delete(File.DirInternal, FilesToDelete.Get(I))
Next
Dim FilesToDelete As List
FilesToDelete.Initialize
FilesToDelete.AddAll(File.ListFiles(File.DirInternal))
For I = 0 To FilesToDelete.Size -1
File.Delete(File.DirInternal, FilesToDelete.Get(I))
Next
I also had a need to remove these files. But I also wanted to view them with traditional viewing tools like a file manager (File Manager HD) and a database utility (SQLite Editor).
Copying them to a less secure directory works fine for these abilities. Thank you NJDude for the pointers in the right direction.
B4X:
Sub copy_protected_files
Dim FilesToCopy As List
FilesToCopy.Initialize
FilesToCopy.AddAll(File.ListFiles(File.DirInternal))
For I = 0 To FilesToCopy.Size -1
File.Copy(File.DirInternal, FilesToCopy.Get(I), File.DirDefaultExternal, FilesToCopy.Get(I))
Next
ToastMessageShow("Databases Copied", True)
End Sub
like this you can delete files that contains a specific string:
B4X:
Sub delusercomplete(deluser As String)
Dim MyFile As String
Dim MyList As List
MyList.initialize
MyList = File.ListFiles(File.DirInternal)
For i = MyList.Size - 1 To 0 Step -1
MyFile = MyList.get(i)
If MyFile.Contains(deluser) Then
File.Delete(File.DirInternal, MyFile)
Log("Deleted File: " & MyFile)
End If
Next
End Sub