S Setlodi Active Member Aug 28, 2023 #1 Hi All I hope you can assist me. My program allows me to save bitmap signatures in .png format in the DirInternal directory. I'm worried that as the files get saved I'm going to run out of space. Now I want to delete all the .png files when I start the app. I have added the wildcards class and I'm able to list *.png files. Now how do I delete these *.png files? Thanks in advance... Code: Copy wcl.Initialize(Me,"wcl") Log(wcl.ListFiles(File.DirInternal, True, "*.png", True, True))
Hi All I hope you can assist me. My program allows me to save bitmap signatures in .png format in the DirInternal directory. I'm worried that as the files get saved I'm going to run out of space. Now I want to delete all the .png files when I start the app. I have added the wildcards class and I'm able to list *.png files. Now how do I delete these *.png files? Thanks in advance... Code: Copy wcl.Initialize(Me,"wcl") Log(wcl.ListFiles(File.DirInternal, True, "*.png", True, True))
Solution M M Mahares Aug 28, 2023 I am pretty sure this line: Code: Copy For i=0 To myListFile-1 Should be: Code: Copy For i= myListFile.Size-1 To 0 Step -1
I am pretty sure this line: Code: Copy For i=0 To myListFile-1 Should be: Code: Copy For i= myListFile.Size-1 To 0 Step -1
zed Well-Known Member Licensed User Aug 28, 2023 #2 Something like that Code: Copy private Sub DeletePNG Dim myListFile As List myListFile.Initialize myListFile=File.ListFiles(File.DirInternal) For i=0 To myListFile-1 Dim myFile As String myFile = myListFile.Get(i) If myFile.SubString(myFile.Length-3) = "png" Then File.Delete(File.DirInternal,myFile) End If Next End Sub Upvote 0
Something like that Code: Copy private Sub DeletePNG Dim myListFile As List myListFile.Initialize myListFile=File.ListFiles(File.DirInternal) For i=0 To myListFile-1 Dim myFile As String myFile = myListFile.Get(i) If myFile.SubString(myFile.Length-3) = "png" Then File.Delete(File.DirInternal,myFile) End If Next End Sub
M Mahares Expert Licensed User Longtime User Aug 28, 2023 #3 I am pretty sure this line: Code: Copy For i=0 To myListFile-1 Should be: Code: Copy For i= myListFile.Size-1 To 0 Step -1 Upvote 0 Solution
I am pretty sure this line: Code: Copy For i=0 To myListFile-1 Should be: Code: Copy For i= myListFile.Size-1 To 0 Step -1
S Setlodi Active Member Aug 28, 2023 #4 Mahares said: I am pretty sure this line: Code: Copy For i=0 To myListFile-1 Should be: Code: Copy For i= myListFile.Size-1 To 0 Step -1 Click to expand... Thank you very much @zed and @Mahares. The second method worked!! Upvote 0
Mahares said: I am pretty sure this line: Code: Copy For i=0 To myListFile-1 Should be: Code: Copy For i= myListFile.Size-1 To 0 Step -1 Click to expand... Thank you very much @zed and @Mahares. The second method worked!!
zed Well-Known Member Licensed User Aug 28, 2023 #5 Mahares said: Should be: Click to expand... Exact Upvote 0