QB64 Phoenix Edition
Killing files - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Killing files (/showthread.php?tid=3734)

Pages: 1 2


RE: Killing files - PhilOfPerth - 06-05-2025

(06-05-2025, 11:18 AM)PhilOfPerth Wrote:
(06-05-2025, 09:30 AM)RhoSigma Wrote: Jesus Christ boys, where do you live?

KILL "path/POP*" and be done with it.

The problem with both of these is that the character after POP varies for each file. Kill "path/POP* doesn't accept the * - it doesn't like the * and returns File Not Found.

(06-05-2025, 08:43 AM)bplus Wrote: or more QBistically and less DOS like:

If Ucase$(Left$(filename$, 3)) = "POP" Then Kill filename$

Sorry bplus, I missed your suggestion. I'll give that a go now. Thanks

 Thanks all. With bits from each of the help responses, I was able to modify the kill process to work. 
There was an additional part to the problem: the "POP" section could be anything, so the path might be for example RecallHist/EDWARD2, so the position of the name within the string is variable, as well as the end character. I fixed it with this line (where HistString$ is the path, and Name$ was previously entered as POP, or EDWARD etc.):
      If Mid$(HistString$, 12, Len(Name$)) = Name$ Then kill HistString$
The amount of help, as usual, was incredible, and much appreciated.
            


RE: Killing files - ahenry3068 - 06-05-2025

(06-05-2025, 12:23 PM)PhilOfPerth Wrote:
(06-05-2025, 11:18 AM)PhilOfPerth Wrote:
(06-05-2025, 09:30 AM)RhoSigma Wrote: Jesus Christ boys, where do you live?

KILL "path/POP*" and be done with it.

The problem with both of these is that the character after POP varies for each file. Kill "path/POP* doesn't accept the * - it doesn't like the * and returns File Not Found.

(06-05-2025, 08:43 AM)bplus Wrote: or more QBistically and less DOS like:

If Ucase$(Left$(filename$, 3)) = "POP" Then Kill filename$

Sorry bplus, I missed your suggestion. I'll give that a go now. Thanks

 Thanks all. With bits from each of the help responses, I was able to modify the kill process to work. 
There was an additional part to the problem: the "POP" section could be anything, so the path might be for example RecallHist/EDWARD2, so the position of the name within the string is variable, as well as the end character. I fixed it with this line (where HistString$ is the path, and Name$ was previously entered as POP, or EDWARD etc.):
      If Mid$(HistString$, 12, Len(Name$)) = Name$ Then kill HistString$
The amount of help, as usual, was incredible, and much appreciated.
            



  MY Suggestion on using the Shell command *WILL* work with wildcards as well.


RE: Killing files - Pete - 06-06-2025

(06-05-2025, 09:30 AM)RhoSigma Wrote: Jesus Christ boys, where do you live?

KILL "path/POP*" and be done with it.

Those 12 boys lived in Israel, but the band broke up after the resurrection. I hear it rivaled Chicago, back in the day.

Pete

+1