delete command help

Hello out there, I need some help deleting some files.

Is there a DOS command that will delete all files of a certain type (in my case *.eml) from ALL directories as opposed to just the specified one?

My problem is that a virus has created about 1500 .eml files all over the place in my computer.


  • There's a pure dos way, then there's the Windows way. Pure dos first.

    Grab a Win98 startup disc, make sure smartdrv is loaded or this'll take a long time to complete.

    Once you are booted, goto the root of the drive that has the e-mails on it, I'll say C: in your case. So,
    C:>dir/s/a/b *.eml > C:email.txt
    C:>edit email.txt

    If you look inside of this file, you'll see that there's a listing (short file names) of all the .eml files in your computer. Go up to search, then find.

    Look for a " first, and if it finds it, delete this file manually.
    Look for a , next, and if it finds it, delete this file manually.

    There shouldn't be any, but just covering all the bases.

    if dos laughs at you for trying to run when it doesn't exist, just go into the toolsoldmsdos directory on the win98 cdrom, and it should be there.

    Once it's " and , free, fire up Qbasic. You can get it from Win98 cdrom in toolsoldmsdos. ver 1.1 will do just fine.
    punch in this code exactly as you see it:

    open "C:email.txt" for input as #1
    do until eof(1)
    input #1, filename$
    shell "del filename$"
    print "Done!"

    Once you are done, press Alt, navigate to the run menu, then select start. The program may take awhile to delete all the messages, so just be patient. you'll get a Done! message when it's done.

    What this will do is open up your C:email.txt file, containing a listing of the .EML files on your computer, then get a name from the file. it deletes it, then moves onto the next file when it's done.

    This won't work if you have some REALLY deep directory structures (8 and over). C:windows1234567 is as deep as you can go. Anything beyond that, and you are out of luck. you can have them, but if any of the .eml files reside in them, they won;t be touched. If the e-mails have hidden/system/read-only attribs on them, this won't work. In that case, go the the root of the C: drive, and type in
    attrib *.eml -s -h -r /s

    That'll strip the attributes from all the .eml files, allowing you to delete them.

    Now, for the windows way. Start -> Find
    In the Name box, enter *.eml, press enter
    single click on any file there, press CTRL+A so that all the files are highlighted, then hold down shift and press delete, answer yes to this box.

    if any of the files are in use at the time you do this, or the virus is watching for them to be deleted, it might not work, so that's why I mentioned the dos way first.

    keep in mind that if you have saved any of your e-mails onto the hard drive, you will have those deleted as well, so be sure to retrieve any .eml files you have saved yourself, and move them to a safe location.

    also, if it's taken place on more than one drive, like C: and D:, just adjust the dir's drive parameter (e.g. dir /s/a/b C: > C:email.txt to dir/s/a/b D: > C:email.txt)

    one last note, when you are working with edit, examining the contents of the email.txt file on the C: drive, if it does find any , or ", I have you take them out because these are delimeters to Qbasic, resulting in a really messed up read. :) if it does find them, reindex that text file,just run the dir command again. if it's on NTFS drive (versus fat32), go for the windows way, dos doesn't work with fat32 (natively). with a 3rd party tsr it can, but I won't go into that here.

    let me know if this works or not, ok??

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion