I was deleting files with B4a today, and the
following command didn't remove the file?
It did find the file with Exists
I checked the manifest file and it does have:
SplitDir = "/mnt/sdcard"
SplitFile = "test.txt"
I ended up using this and it worked:
I am more curious why the first snippet didn't work?
following command didn't remove the file?
It did find the file with Exists
I checked the manifest file and it does have:
B4X:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
SplitDir = "/mnt/sdcard"
SplitFile = "test.txt"
B4X:
If File.Exists(SplitDir,SplitFile) Then
Msgbox("File Is being Deleted now!","DELETED")
File.Delete(SplitDir,SplitFile)
Else
Msgbox("Can't find file!","NOPE")
End If
I ended up using this and it worked:
B4X:
If File.Exists(SplitDir,SplitFile) Then
Msgbox("File Is being Deleted now!","DELETED")
Dim sb As StringBuilder
sb.Initialize
p.Shell("rm -r " & SplitDir & "/" & SplitFile , Null, sb, Null) ' free space
Else
Msgbox("Can't find file!","NOPE")
End If
I am more curious why the first snippet didn't work?