lroberts@en.ecn.purdue.edu (Larry S Roberts) (01/08/91)
I have written a program that uses the findfirst, findnext, and remove library functions to delete files from a directory, however, I have noticed that the dos command "del *.*" works almost instantly when compared to my program. My program has to access every file and it seems like the dos command only makes one disk access. Also the remove function will not take wild cards, so this is not an option. How does del *.* work, and how can I incorporate this in my software? Thanks. -- --- Larry S. Roberts 8450robertsl@indinpls.navy.mil lroberts@en.ecn.purdue.edu
yawei@bronze.ucs.indiana.edu (mr. yawei) (01/09/91)
In article <1991Jan8.123410.1564@en.ecn.purdue.edu> lroberts@en.ecn.purdue.edu (Larry S Roberts) writes: >I have written a program that uses the findfirst, findnext, and remove library >functions to delete files from a directory, however, I have noticed that the >dos command "del *.*" works almost instantly when compared to my program. My >program has to access every file and it seems like the dos command only makes >one disk access. Also the remove function will not take wild cards, so this is >not an option. > >How does del *.* work, and how can I incorporate this in my software? Thanks. I think 'del *.*' works via DOS function 13h (or 0x13, if you preferred), the 'delete with FCB' function, with the filename field set to '????????.???'. yawei
bytehead@bluemoon.uucp (Bryan Price) (01/14/91)
lroberts@en.ecn.purdue.edu (Larry S Roberts) writes: > I have written a program that uses the findfirst, findnext, and remove librar > functions to delete files from a directory, however, I have noticed that the > dos command "del *.*" works almost instantly when compared to my program. My > program has to access every file and it seems like the dos command only makes > one disk access. Also the remove function will not take wild cards, so this > not an option. > > How does del *.* work, and how can I incorporate this in my software? Thanks DEL *.* doing it instantly?? You running on a 50MHZ '486 with a SCSI drive? I don't think so! :-) My MS-DOS version of rm is just as fast, and has more options. The possible difference that I see is that you may be getting a filename from findfirst/findnext, then deleting it, then getting the next filename from findnext. I run through findfirst/findnext first, putting all the filenames into an array, then delete them. > --- > Larry S. Roberts > > 8450robertsl@indinpls.navy.mil lroberts@en.ecn.purdue.edu --- Bryan Price bytehead@bluemoon
doerschu@rex.cs.tulane.edu (Dave Doerschuk) (01/14/91)
In article <58340001@hpopd.pwd.hp.com> dcc@hpopd.pwd.hp.com (Daniel Creswell) writes: >I'd be willing to bet that while you use nice friendly calls del either uses >some undocumented dirty one's or more likely goes straight to the FAT by- >passing all those slow calls your making. I may be wrong but I'd have a guess >at that! An item that I haven't seen yet in this thread is that del is "resident", so to speak, in command.com. I think. Meaning that the loader doesn't need to go out to disk and find a file named "del.com", since it doesn't exist! I'd assume that the code for del is located in the transient part of command.com, but I'm no expert. This is certainly part of the reason why del operates so quickly, no need to read/load the executable file. Thanks for reading, Dave doerschu@rex.cs.tulane.edu
williams@umaxc.weeg.uiowa.edu (Kent Williams) (01/14/91)
In article <2yoqV2w163w@bluemoon.uucp> bytehead@bluemoon.uucp (Bryan Price) writes: >DEL *.* doing it instantly?? You running on a 50MHZ '486 with a SCSI >drive? I don't think so! :-) > >My MS-DOS version of rm is just as fast, and has more options. The >possible difference that I see is that you may be getting a filename from >findfirst/findnext, then deleting it, then getting the next filename from >findnext. I run through findfirst/findnext first, putting all the >filenames into an array, then delete them. > Once again, with feeling: del <pat> in COMMAND.COM uses the FCB delete function (13H) in order to nuke files. It allows '?' wild cards. It is a DOS 1.0 function so it only works in the current directory, so you have to parse off the path part, change directory there, delete stuff, then change directory back. It is much faster than any find-first find-next combination, which in conjunction with delete-file tends to thrash the disk updating internal tables. -- Kent Williams --- williams@umaxc.weeg.uiowa.edu "'Is this heaven?' --- 'No, this is Iowa'" - from the movie "Field of Dreams" "This isn't heaven, ... this is Cleveland" - Harry Allard, in "The Stupids Die"