ts@uwasa.fi (Timo Salmi LASK) (06/26/90)
In article <1990Jun24.043414.24256@caen.engin.umich.edu> mrice@caen.engin.umich.edu (Michael Rice) writes: > >Hi. I would like to know if the following can be done? >I have a batch file that does a DEL subdirectory >where subdirectory is some temporary directory. The problem is >DOS asks the question about "All files will be deleted Are you >sure? " There are a couple of ways to do this, the most elegant being echo y | del YourSub\*.* > nul, as pointed out in this newsgroup by several postings. (There have also been a couple of clearly incorrect solutions suggested). If you want to delete the files AND the subdirectory, that can be done as well. For how, I shall refer you to /pc/ts/tsbat21.arc, which has quite a number of batch files with accumulated batch programming tricks in them. Available by anonymous ftp from chyde.uwasa.fi, Vaasa, Finland. If you need prerecoded information about chyde.uwasa.fi ftp, just send me an email request. ................................................................... Prof. Timo Salmi (Moderating at anon. ftp site 128.214.12.3) School of Business Studies, University of Vaasa, SF-65101, Finland Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun
cak@vpnet.chi.il.us (Cindi Knox) (06/26/90)
OK, now that the obvious suggestions are taken care of, here's one that's a
little less efficient but more selective.
outside batch:
for %a in (*.*) do del %a
inside batch:
for %%a in (*.*) do del %%a
(%)%a can be replace with a different %% variable if you like.
in (*.*) can be replaced with a list like:
for %%a in (*.$$$ *.BAK *.JNK JUNK*.*) do del %%a
You can do some great things with this.
I doubt any of these opinions are those of my employer.
I don't agree with ANYTHING they say.
Cindi Knox | You've got a lot of living to do without life.
|
cak@vpnet.chi.il.us | ``Little Miss S.'' by Edie Brickell and New Bohemians.
cak@vpnet.chi.il.us (Cindi Knox) (06/29/90)
the reason ^Break won't work when you
y|del *.*
is that break checking is normally done only on console calls: i.e. screen
writes and keyboard reads. So the command y (which doesn't exist) opens
a pipe to del's input, the input ends, del is not satisfied and waits in
a loop of calls to DISK I/O! No break checking here. To get DOS to do
more break checking (at the penalty of some processing speed... nothing
drastic) put
BREAK = ON
in your config.sys or type
BREAK ON
This gives you break checking within ALL DOS function calls. This still
doesn't help if you're stuck in a non-function calling loop though it WILL
fix the hang/can't break problem in y|del *.*
I doubt any of these opinions are those of my employer.
I don't agree with ANYTHING they say.
Cindi Knox | You've got a lot of living to do without life.
|
cak@vpnet.chi.il.us | ``Little Miss S.'' by Edie Brickell and New Bohemians.
drezac@dcsc.dla.mil (Duane L. Rezac) (06/29/90)
From article <1990Jun24.043414.24256@caen.engin.umich.edu>, by mrice@caen.engin.umich.edu (Michael Rice): > > Hi. I would like to know if the following can be done? > I have a batch file that does a DEL subdirectory > where subdirectory is some temporary directory. The problem is > DOS asks the question about "All files will be deleted Are you > sure? " > > Well of course I am sure, and this message just makes the batch file > a lot less elegant and not as automatic as I would like. Is there > a way to bypass this or supply the answer from the batch file? I tried > redirecting it to NUL but this only suppresses the message not the > pause for the Y/N response. Any suggestions will be much appreciated. > > It's easy to do, we do it all the time here. just create a file in root (or somewhere in the path) called y.dat. It should contain only a "Y". then redirect this as input (i.e del *.* <y.dat) . Y.dat will feed the Y to the Y/N question and the command will continue. Duane L. Rezac -- Verse of the Hour: "This is my commandment, That ye love one another, as I have loved you". John 15:12 -- +-----------------------+---------------------------------------------------+ | Duane L. Rezac |These views are my own, and NOT representitive of my place| | dsacg1!dcscg1!drezac drezac@dcscg1.dcsc.dla.mil of Employment. | +-----------------------+---------------------------------------------------+
richard@iesd.auc.dk (Richard Flamsholt S0rensen) (07/11/90)
In article <268abc49-d6.10comp.sys.ibm.pc.programmer-1@vpnet.chi.il.us> cak@vpnet.chi.il.us (Cindi Knox) writes: >the reason ^Break won't work when you > >y|del *.* > >is that break checking is normally done only on console calls: > [...] >put > >BREAK = ON > >in your config.sys [...] Nope - I *have* BREAK=ON in my config.sys and the piping *still* hangs the computer. -- /Richard Flamsholt richard@iesd.auc.dk