QB64 Phoenix Edition
Kill a directory in DOS - 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: Kill a directory in DOS (/showthread.php?tid=2211)

Pages: 1 2 3 4


Kill a directory in DOS - eoredson - 11-30-2023

Hi,

I have recently been able to Kill Filename$ but I would like a function to Kill Directory$

I know in Command.com and Cmd.exe the DEL command has /S to delete all subdirectories but Dosbox-X does not..

Or could a batch file do it??

Erik.


RE: Kill a directory in DOS - TerryRitchie - 11-30-2023

(11-30-2023, 04:16 AM)eoredson Wrote: Hi,

I have recently been able to Kill Filename$ but I would like a function to Kill Directory$

I know in Command.com and Cmd.exe the DEL command has /S to delete all subdirectories but Dosbox-X does not..

Or could a batch file do it??

Erik.
Use the RMDIR command

https://qb64phoenix.com/qb64wiki/index.php/RMDIR


RE: Kill a directory in DOS - eoredson - 11-30-2023

(11-30-2023, 04:26 AM)TerryRitchie Wrote:
(11-30-2023, 04:16 AM)eoredson Wrote: Hi,

I have recently been able to Kill Filename$ but I would like a function to Kill Directory$

I know in Command.com and Cmd.exe the DEL command has /S to delete all subdirectories but Dosbox-X does not..

Or could a batch file do it??

Erik.
Use the RMDIR command

https://qb64phoenix.com/qb64wiki/index.php/RMDIR
Nope. That only deletes an empty directory!?


[Image: deldir.png]


RE: Kill a directory in DOS - TerryRitchie - 11-30-2023

(11-30-2023, 04:35 AM)eoredson Wrote:
(11-30-2023, 04:26 AM)TerryRitchie Wrote:
(11-30-2023, 04:16 AM)eoredson Wrote: Hi,

I have recently been able to Kill Filename$ but I would like a function to Kill Directory$

I know in Command.com and Cmd.exe the DEL command has /S to delete all subdirectories but Dosbox-X does not..

Or could a batch file do it??

Erik.
Use the RMDIR command

https://qb64phoenix.com/qb64wiki/index.php/RMDIR
Nope. That only deletes an empty directory!?
You can use the RD command at the command prompt with the /S switch but be very careful. Here is a link in the tutorial covering the command prompt commands RD and RMDIR.

https://www.qb64tutorial.com/lessoncli#h.qrrgmgz1s3g1


RE: Kill a directory in DOS - eoredson - 11-30-2023

(11-30-2023, 04:38 AM)TerryRitchie Wrote:
(11-30-2023, 04:35 AM)eoredson Wrote:
(11-30-2023, 04:26 AM)TerryRitchie Wrote: Use the RMDIR command

https://qb64phoenix.com/qb64wiki/index.php/RMDIR
Nope. That only deletes an empty directory!?
You can use the RD command at the command prompt with the /S switch but be very careful. Here is a link in the tutorial covering the command prompt commands RD and RMDIR.

https://www.qb64tutorial.com/lessoncli#h.qrrgmgz1s3g1

As I already stated: Dosbox-X Rd does not have a /S switch.


RE: Kill a directory in DOS - TerryRitchie - 11-30-2023

Ok, I'm confused. You're running QB64 programs in Dosbox?


RE: Kill a directory in DOS - eoredson - 11-30-2023

I am running QB64 yes.

I am trying to be backward compatible to qb11, qb45, and qb71.


RE: Kill a directory in DOS - SMcNeill - 11-30-2023

(11-30-2023, 04:50 AM)eoredson Wrote: I am running QB64 yes.

I think this is a bad thread..

https://qb64phoenix.com/qb64wiki/index.php/RMDIR


RE: Kill a directory in DOS - eoredson - 11-30-2023

(11-30-2023, 04:53 AM)SMcNeill Wrote:
(11-30-2023, 04:50 AM)eoredson Wrote: I am running QB64 yes.

I think this is a bad thread..

https://qb64phoenix.com/qb64wiki/index.php/RMDIR
So, I should shell to RMDIR?


RE: Kill a directory in DOS - SMcNeill - 11-30-2023

As for doing it in a DosBox-X specific way, you should really read their documentation and learn the old commands which they emulate.  

https://github.com/joncampbell123/dosbox-x/wiki/DOSBox%E2%80%90X%E2%80%99s-Supported-Commands

Specifically scroll down and look at the DELTREE command: 
Quote:DELTREE (external command)

Deletes a directory and all the subdirectories and files in it.

Usage: DELTREE [/Y] [drive:]path [[drive:]path[…]]

Note: This will delete the entire directory tree. Please use this command with caution.