Windows 10: Delete multiple folders Solved

  1.    06 Mar 2018 #1

    Delete multiple folders


    I have a folder with 440 folders, half of them are the as another with - copy appended to the name, is there any way I could delete them? I tried the commad prompt using "del *copy" and it didn't work. Any other ideas?
      My ComputerSystem Spec

  2.    06 Mar 2018 #2

    del doesn't work on folders. rmdir is used for that but unfortunately it doesn't work with wildcards.

    You can do this in PowerShell:
    Code:
    powershell "Get-Item '* - Copy' | Remove-Item -Recurse -Force"
    For example:

    Code:
    C:\TEMP\test>dir Directory of C:\TEMP\test
    
    
    03/06/2018  12:02 PM    <DIR>          .
    03/06/2018  12:02 PM    <DIR>          ..
    03/06/2018  11:47 AM    <DIR>          a
    03/06/2018  11:47 AM    <DIR>          a - Copy
    03/06/2018  11:48 AM    <DIR>          b
    03/06/2018  11:48 AM    <DIR>          b - Copy
    03/06/2018  11:48 AM    <DIR>          c
    03/06/2018  11:48 AM    <DIR>          c - Copy
    
    
    C:\TEMP\test>powershell "Get-Item '* - Copy' | Remove-Item -Recurse -Force"
    
    
    C:\TEMP\test>dir
     Directory of C:\TEMP\test
    
    
    03/06/2018  12:02 PM    <DIR>          .
    03/06/2018  12:02 PM    <DIR>          ..
    03/06/2018  11:47 AM    <DIR>          a
    03/06/2018  11:48 AM    <DIR>          b
    03/06/2018  11:48 AM    <DIR>          c
      My ComputerSystem Spec

  3.    06 Mar 2018 #3

    Great! Thanks!
      My ComputerSystem Spec

  4.    06 Mar 2018 #4

    Interesting, it deleted ~220 folders, 4 weren't deleted error said something like 'folder not empty', looked at the folders they were empty, reran the command and it cleared out those four.

    Thanks again!
      My ComputerSystem Spec


 

Related Threads
This issue has been going on for months on end and an possible solution I've seen has not worked, any help would be appreciated!
I recently deleted some mp3 files and folders, then when I emptied the Recycle Bin I inadvertently answered "no" to the "are you sure you want to delete these files" question. Now they are sitting on my recent files / frequent folders page and will...
Solved Can't delete files/folders in General Support
I have extracted some emulation files into my internal G: drive, and I decided they aren't what I needed and tried to delete them. Most of the files deleted but I have 3 folders and several files that will not delete. I can't delete the files (which...
Cannot delete tmp folders in General Support
Hi, small annoying problem, when I go to 'My PC' somehow I have a lot of temporary folders on my C: drive, and cannot get rid of them. Says that 'You require permission from the administrator to make these changes. I have tried using the command...
Can i Delete this Folders? in General Support
Can i Delete Folder $Windows.~BT and $Windows.~WS on C: Drive?
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 22:23.
Find Us