[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Deleting Files



** Reply to messages


> If you are (as Carl said) using Xy3 and cant use a U2 subrutin to erase
> the files and then go back to xy to continue your program without answering
> the y/n question, you can use Carls DOS command, but with an
> ECHO command and a pipe <|> to send the "y" that the del program is asking
> for:
>
> Xy3:
>  DOS /C ECHO Y | DEL *.*
>
> Xy4:
>  DOS/NV/Z /C ECHO Y | DEL *.*
>
>  Of course, be carefull with it...

Alternatively (no piping):

Xy3:
 DOS /C KMD.EXE /C DEL /Q [d:\path\]*.*
Xy4:
 DOS/NV/Z /C KMD.EXE /C DEL /Q [d:\path\]*.*

> I'll be damned...it works perfectly (and even though
> it exits DOS like I need it > to, I can't see how it's
> done. Is "exit" just a by-product of this string of
> commands? What if you didn't want it to exit?).

"Exit" is inherent in "DOS /C" -- shell to DOS, and issue
one command. If you don't wish to exit, execute KMD /K
instead of KMD /C:

Xy4:
 DOS/NV /C KMD.EXE /K [command1 & command2 & ...]

That would issue the specified command[s] (or no command)
and remain at a command prompt until you issued "Exit", to
return to XyWrite.

> Use the DOS command DELTREE (i.e., delete "tree" of specified directory
> plus its contents plus all subdirectories beneath it and their contents).
> Also requires an ECHO Y.

DELTREE is bundled with W98, but not NT (nor W95, IIRC). Two solutions:
DELTREE.CMD, which is part of XyShell; or the much-enhanced RMDIR|RD command
which is part of NT (and, by virtue of KMD.EXE, available in 9x also), e.g.:

Xy4:
 DOS/NV/Z /C KMD/C RD/S/Q [d:]\path

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------