Why would you need to shell?? RMDIR is a built in QB64 command, just as KILL is. Are we on the same page here?? You *ARE* asking how to use QB64 to remove directories, right??
Print "Enter dir spec:";
Input Dir$
If _DirExists(Dir$) Then
RmDir Dir$
End If
If the directory isn't empty, then you'll need to write a routine to change to get the files in that directory, KILL them, and then RMDIR that directory. If there's directories inside that directory and not just files, then you'll want that routine to work recursively.
11-30-2023, 05:13 AM (This post was last modified: 11-30-2023, 05:37 AM by eoredson.)
(11-30-2023, 05:10 AM)SMcNeill Wrote:
Code: (Select All)
Print "Enter dir spec:";
Input Dir$
If _DirExists(Dir$) Then
RmDir Dir$
End If
If the directory isn't empty, then you'll need to write a routine to change to get the files in that directory, KILL them, and then RMDIR that directory. If there's directories inside that directory and not just files, then you'll want that routine to work recursively.
Very well stated! That is what I was starting to do..
Could you write one?? It would have to be internal without any shell.
Given the two functions Kill and RMdir it could be done...
Print "Enter dir spec:";
Input Dir$
If _DirExists(Dir$) Then
RmDir Dir$
End If
If the directory isn't empty, then you'll need to write a routine to change to get the files in that directory, KILL them, and then RMDIR that directory. If there's directories inside that directory and not just files, then you'll want that routine to work recursively.
Very well stated! That is what I was starting to do..
Could you write one?? It would have to be internal without any shell.
Given the two functions Kill and RMdir it could be done...
11-30-2023, 05:40 AM (This post was last modified: 11-30-2023, 05:46 AM by eoredson.)
(11-30-2023, 05:37 AM)TerryRitchie Wrote: Hold the phone, I'm still stuck on the QB64 in the Dosbox thing. Compiled QB64 programs will not run in Dosbox. Dosbox emulates 16bit architecture.
Ok. I am using QB64 for a directory delete function and it is compatible with QB1, 4, and 7 in Dosbox-x.
Does that make sense?? All I want to do is Kill Dir$
(11-30-2023, 05:37 AM)TerryRitchie Wrote: Hold the phone, I'm still stuck on the QB64 in the Dosbox thing. Compiled QB64 programs will not run in Dosbox. Dosbox emulates 16bit architecture.
Ok. I am using QB64 for a directory delete function and it is compatible with QB1, 4, and 7 in Dosbox-x.
Does that make sense?? All I want to do is Kill Dir$
Nope, still doesn't make sense to me. The code provided by Steve will not work in anything except QB64. You need to write your code using QuickBasic 4.5 inside of DosBox. If Dosbox supports DELTREE then you can shell to that.
Even if QB64 did include a KillDir command as you requested what good would that do you in Dosbox? QuickBasic would look at that command and error.
New to QB64pe? Visit the QB64 tutorial to get started. QB64 Tutorial