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

RE: Deleting Files



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?).

I really didn't think there was going to be a solution. Thank you very much, Francisco!

BTW...what I'm doing is writing a program that creates a series of temp files in a sub-directory.
These files are then used by a
second program, and I need it to "clean-up" the files afterwards. I had hoped that the
easy way to delete the files would be to
simply delete the sub-directory but, as some of you already know, you can't delete a directory that
isn't empty (although, there's
probably a work-around for that too).

Since posting my initial question, I had come up with a longer solution...I would keep track of the
file names created (the names
are based on info within the file I'm running the macro on) and delete them by name afterwards. But
now I can write the macro the
easy way (and if it turns out to be too unsafe...I still have a back-up method).

_Brian H.

-----Original Message-----

 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, perhaps you can fill the full path to
avoid fatal erases:

BC DOS /C ECHO Y | DEL C:\HERE\THERE\*.*

(I supose you are in a english windows or dos version, in spanish I use S/N
instead of Y/N)

  Francisco Barrau

----- Original Message -----
From: "Harry Binswanger" 
To: 
Sent: Friday, April 23, 2004 11:16 PM
Subject: Re: Deleting Files


> Brian wrote:
>
> >After looking through the manuals, I find that there's no way to "blind"
> >delete all the files in a directory (i.e. DEL *.* or DEL *).
>
> I'm not sure what the problem is--is it that shelling out to DOS and doing
> a del *.* gives you a (y/n) prompt? Or is it that you don't know how to
> shell out to DOS under program control? If the latter, the XPL pseudo-code
is:
>
> dos /c del *.*
>
> while in DOS, you'll have to hit "y" to do the actual deletion. Then it
> will automatically come back to Xy.
>
> If you can't deal with hitting the "y" there are work-arounds, but they
are
> not elegant.
>
>
> Harry Binswanger
> hb@xxxxxxxx
>
>