1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Resolved Deleting mutiple files

Discussion in 'Windows XP' started by jpChris, 2012/01/23.

  1. 2012/01/23
    jpChris

    jpChris Inactive Thread Starter

    Joined:
    2003/09/21
    Messages:
    1,062
    Likes Received:
    9
    Hi all,

    I forgot. :eek:

    I have a ton of files all over the place on two HD's (C;D;E;G;H;I)that I want to delete with a command.

    I know the highlight\shift\r-click\delete method, but I'm looking for a command prompt from the run line to do it.

    I think I remember something about "del tree" something, but, like I said, It's been so long I forgot how to do it.

    I've got the first part down: Start| Run | CMD, it's what to fill in after that?
     
  2. 2012/01/23
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,076
    Likes Received:
    178
    Its "deltree /y {filenames} ".

    But it won't work in Vista or Win 7 as the deltree.com is not there.
     

  3. to hide this advert.

  4. 2012/01/23
    retiredlearner

    retiredlearner SuperGeek WindowsBBS Team Member

    Joined:
    2004/06/25
    Messages:
    7,209
    Likes Received:
    514
  5. 2012/01/23
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,076
    Likes Received:
    178
    del would also do the trick but it won't delete empty sub directories. deltree would delete everything.
     
  6. 2012/01/24
    Arie

    Arie Administrator Administrator Staff

    Joined:
    2001/12/27
    Messages:
    15,174
    Likes Received:
    412
    Deltree was replaced by rmdir which is the same as rd.

     
    Arie,
    #5
  7. 2012/01/24
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,076
    Likes Received:
    178
    Thanks Arie for that. Didn't venture beyond rd before.
     
  8. 2012/01/24
    jpChris

    jpChris Inactive Thread Starter

    Joined:
    2003/09/21
    Messages:
    1,062
    Likes Received:
    9
    Thanks for the info.

    So, I have hundreds of files on all drives named "*.abc" (where the * is the various file names — but they're all the .abc extension). I click Start | Run | CMD and type in: "del tree /y *.abc" (without the quotes) and all files that are "*.abc" will be deleted from all drives?
     
  9. 2012/01/24
    wildfire

    wildfire Getting Old

    Joined:
    2008/04/21
    Messages:
    4,649
    Likes Received:
    124
    No as has been posted Del Tree (or deltree) is no longer an option.

    Use Del with the /s switch

    ie

    Code:
    del /s *.abc
    Will delete all *.abc files from the current directory and below. Chris be carefull when doing this. I suggest you type

    Code:
    del /?
    and make sure you understand what you are doing before you proceed.
     
  10. 2012/01/24
    jpChris

    jpChris Inactive Thread Starter

    Joined:
    2003/09/21
    Messages:
    1,062
    Likes Received:
    9
    Hi wildfire,

    So, to delete all .abc files on all drives I click Start | Run | CMD and type in:

    del /s *.abc

    Correct? That'll delete all .abc from all drives, bypassing the Recycle Bin?

    As far as being careful, I hear ya loud and clear. All the files I'm looking to delete are cloaked files that I no longer need.

    I've been computing for so long that I've forgotten more than I remember "” or something like that. :p
     
    Last edited: 2012/01/24
  11. 2012/01/24
    rsinfo

    rsinfo SuperGeek Alumni

    Joined:
    2005/12/25
    Messages:
    4,076
    Likes Received:
    178
    That would delete files only from the current partition [usually C:]. To delete from other partitions/drive you would have either to give drive letters or change to that drive first.
     
  12. 2012/01/24
    markp62

    markp62 Geek Member Alumni

    Joined:
    2002/05/01
    Messages:
    4,012
    Likes Received:
    16
    I think it would be easier for you to use WinXP Search function. Have it start at C:, set it to go through all folders, and have it search for *.abc and then delete what it finds.
    Command prompt deletions can be very dangerous for the novice.
    But these are the commands you are looking for.
    c:
    del /s *.abc
    d:
    del /s *.abc
    e:
    del /s *.abc
    f:
    del /s *.abc
    g:
    del /s *.abc
    h:
    del /s *.abc
    i:
    del /s *.abc

    Be careful for typos.
     
    Last edited: 2012/01/24
  13. 2012/01/25
    wildfire

    wildfire Getting Old

    Joined:
    2008/04/21
    Messages:
    4,649
    Likes Received:
    124
    Slight amendment to marks instructions, as MS OS's remember current directories for each drive/partition use CD \ after changing drives to ensure you are in the root directory.

    Anyway as Mark also pointed out this is a very dangerous command so use with great caution.
     
  14. 2012/01/31
    jpChris

    jpChris Inactive Thread Starter

    Joined:
    2003/09/21
    Messages:
    1,062
    Likes Received:
    9
    Hi guys,

    Thanks for the information. So, I'm going to have to change the directory for each drive. There isn't an all-in-one command (like: C:\;D:\;E:\ del / *.abc) is there? :confused: I know in e-mail that different addresses need to be separated by a semicolon, but I take it it doesn't apply here?
     
  15. 2012/02/01
    dnmacleod

    dnmacleod Well-Known Member

    Joined:
    2009/05/16
    Messages:
    419
    Likes Received:
    58
    You could create a batch file and list all the commands you want to run in it. Save it to your chosen location and run it from there.
     
  16. 2012/02/01
    wildfire

    wildfire Getting Old

    Joined:
    2008/04/21
    Messages:
    4,649
    Likes Received:
    124
    Code:
    FOR %I IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO DEL %I:\*.ABC /S
    Should work, remove any drive letters from the list you don't have/want to delete (eg Floppies, CD Drives etc).
     
  17. 2012/02/01
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
  18. 2012/02/02
    markp62

    markp62 Geek Member Alumni

    Joined:
    2002/05/01
    Messages:
    4,012
    Likes Received:
    16
    One little thing, when using variables in a batch file, we need to use the double parenthesis signs, else you get an error. When typing in manually you only need the single parenthesis sign.
    Code:
    for %%x in (c d e g h i) do del %%x:\*.abc /f /s /a
     
  19. 2012/02/11
    jpChris

    jpChris Inactive Thread Starter

    Joined:
    2003/09/21
    Messages:
    1,062
    Likes Received:
    9
    Hi all,

    I apologize for the tardy reply, but, I've been suffering from and extreme, acute case of ennui. :rolleyes:

    Anyway, let me be sure I understand this:

    I open Notepad, I paste in the above (for %%x in (c d e g h i) do del %%x:\*.abc /f /s /a), save it as a .bat file and that'll delete all the .abc files on both HDs on my computer, correct?

    OK, I think I just answered my question. I created 6 files and named them ".abc ". I cut and pasted each one into each drive (C, D, E, G, H, I). I saved the file above as a .bat file and ran it. I did a Search and there were no .abc files on any drive.

    Am I cool???
     
    Last edited: 2012/02/11
  20. 2012/02/12
    dnmacleod

    dnmacleod Well-Known Member

    Joined:
    2009/05/16
    Messages:
    419
    Likes Received:
    58
    Always a good idea in situations like this to - as you did - create dummy files to practice a command line execution routine on. At least that way, if the command doesn't quite run as planned, there's no real harm done.
     
  21. 2012/02/12
    SpywareDr

    SpywareDr SuperGeek WindowsBBS Team Member

    Joined:
    2005/12/31
    Messages:
    3,752
    Likes Received:
    338
    Another way would be to insert an "echo" between the "do" and "del ":
    Code:
    for %x in (c d e g h i) do [color=red]echo[/color] del %x:\*.abc /f /s /a

    Or, if in a batch file:
    Code:
    for %%x in (c d e g h i) do [color=red]echo[/color] del %%x:\*.abc /f /s /a
     
    Last edited: 2012/02/12

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.