Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Deleting Windows folders...

Deleting Windows folders...

Scheduled Pinned Locked Moved The Lounge
question
24 Posts 13 Posters 23 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dandy72
    wrote on last edited by
    #1

    I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

    K A abmvA N J 7 Replies Last reply
    0
    • D dandy72

      I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

      K Offline
      K Offline
      k5054
      wrote on last edited by
      #2

      Put live Linux on a USB, boot, mount Windows share, rm -rf Folder1, Folder2, Folder3 ..., Remove Linux USB, Boot back to windows. Done.

      Keep Calm and Carry On

      D 1 Reply Last reply
      0
      • K k5054

        Put live Linux on a USB, boot, mount Windows share, rm -rf Folder1, Folder2, Folder3 ..., Remove Linux USB, Boot back to windows. Done.

        Keep Calm and Carry On

        D Offline
        D Offline
        dandy72
        wrote on last edited by
        #3

        Interesting... But isn't access still being controlled/enforced by NTFS ACLs?

        D 1 Reply Last reply
        0
        • D dandy72

          Interesting... But isn't access still being controlled/enforced by NTFS ACLs?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          NTFS? --Linux

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

          D 1 Reply Last reply
          0
          • D dandy72

            I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

            A Offline
            A Offline
            Amarnath S
            wrote on last edited by
            #5

            Same experience here. I had a laptop with a 2 TB hard disk having four partitions C, D, E, F, 500 GB each with C: having the Win OS. Now, that laptop fell and broke, but luckily nothing happened to the hard disk. I put a cover to this 2 TB hard disk with a USB outlet; essentially making it an external hard drive. It doesn't allow me to delete the Windows folder on that external drive. Same story with Program Files, Program Data.

            D 1 Reply Last reply
            0
            • D dandy72

              I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

              abmvA Offline
              abmvA Offline
              abmv
              wrote on last edited by
              #6

              just move the vms to another temp ssd/hdd .. format the old ssd copy it back.. save you trouble

              Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

              We are in the beginning of a mass extinction. - Greta Thunberg

              OriginalGriffO D C 3 Replies Last reply
              0
              • D dandy72

                I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

                N Offline
                N Offline
                Nelek
                wrote on last edited by
                #7

                Get in trouble shooting windows when booting and remove the folders in CMD Or boot up from a external medium (Hiren's Boot, Bart PE...) and remove the folders from the virtual OS

                M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                1 Reply Last reply
                0
                • abmvA abmv

                  just move the vms to another temp ssd/hdd .. format the old ssd copy it back.. save you trouble

                  Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #8

                  That's the way I'd do it - and probably a repartition to dump any bootable stuff as well.

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  G 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    NTFS? --Linux

                    Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                    D Offline
                    D Offline
                    dandy72
                    wrote on last edited by
                    #9

                    Yeah, the partition is NTFS, as I understand it, someone reverse-engineered it all and implemented a Linux driver so NTFS partitions can be mounted/read like any other. NTFS implements ACLs (access control lists) to determine who has access to files/folders. That's part of the file system, so the Linux driver has to follow that in order to be able to access anything. I could be wrong, but that would infer ACLs could be completely bypassed simply by ignoring them. Kinda like movies where someone is prompted for a password, and just types in 'override'. :-) I'll certainly give it a shot, I have other (unrelated) fires to put out this morning...

                    1 Reply Last reply
                    0
                    • abmvA abmv

                      just move the vms to another temp ssd/hdd .. format the old ssd copy it back.. save you trouble

                      Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

                      D Offline
                      D Offline
                      dandy72
                      wrote on last edited by
                      #10

                      Yeah, that's exactly what I said I wanted to avoid, but in the end, would've been quicker...

                      1 Reply Last reply
                      0
                      • A Amarnath S

                        Same experience here. I had a laptop with a 2 TB hard disk having four partitions C, D, E, F, 500 GB each with C: having the Win OS. Now, that laptop fell and broke, but luckily nothing happened to the hard disk. I put a cover to this 2 TB hard disk with a USB outlet; essentially making it an external hard drive. It doesn't allow me to delete the Windows folder on that external drive. Same story with Program Files, Program Data.

                        D Offline
                        D Offline
                        dandy72
                        wrote on last edited by
                        #11

                        It took quite a bit of time and patience, but taking ownership of files/folders, I managed to get rid of everything (Program Files, ProgramData) except for a number of Windows subfolders. Some of them just will NOT let me take over. I'll probably just move the VMs folder to another disk and reformat the disk altogether. And merge the boot partition with it, while I'm at it.

                        1 Reply Last reply
                        0
                        • abmvA abmv

                          just move the vms to another temp ssd/hdd .. format the old ssd copy it back.. save you trouble

                          Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

                          C Offline
                          C Offline
                          charlieg
                          wrote on last edited by
                          #12

                          yep, exactly what I would do....

                          Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                          1 Reply Last reply
                          0
                          • D dandy72

                            I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #13

                            Interesting problem. Googling I found the following. First response certainly seems informed. I didn't even know about the commands presented. https://superuser.com/questions/915173/delete-old-windows-program-files-from-second-drive[^]

                            D R 2 Replies Last reply
                            0
                            • J jschell

                              Interesting problem. Googling I found the following. First response certainly seems informed. I didn't even know about the commands presented. https://superuser.com/questions/915173/delete-old-windows-program-files-from-second-drive[^]

                              D Offline
                              D Offline
                              dandy72
                              wrote on last edited by
                              #14

                              Yup, I knew about both takeown and icacls (and its predecessor cacls), but there are some (deeply embedded) folders that still don't like to be reassigned. That response on superuser.com might be using a combination of command-line args that I haven't tried - thanks for that.

                              1 Reply Last reply
                              0
                              • D dandy72

                                I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #15

                                Maybe SSD's are "small" so you don't keep anything except the OS on them. I'm in awe when a product lets me install on the drive I choose.

                                "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

                                D 1 Reply Last reply
                                0
                                • L Lost User

                                  Maybe SSD's are "small" so you don't keep anything except the OS on them. I'm in awe when a product lets me install on the drive I choose.

                                  "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

                                  D Offline
                                  D Offline
                                  dandy72
                                  wrote on last edited by
                                  #16

                                  Wut? This SSD is 2TB. It hosted both an OS (Windows 10) and Hyper-V VMs. Since each VM hosts its own OS, it makes sense to put VMs on SSD and not bulk storage disks like spinning disks.

                                  1 Reply Last reply
                                  0
                                  • J jschell

                                    Interesting problem. Googling I found the following. First response certainly seems informed. I didn't even know about the commands presented. https://superuser.com/questions/915173/delete-old-windows-program-files-from-second-drive[^]

                                    R Offline
                                    R Offline
                                    RodClark
                                    wrote on last edited by
                                    #17

                                    Yep, the method linked is the 'correct'/'best' method... Takeown and then icalcs Rod

                                    1 Reply Last reply
                                    0
                                    • OriginalGriffO OriginalGriff

                                      That's the way I'd do it - and probably a repartition to dump any bootable stuff as well.

                                      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

                                      G Offline
                                      G Offline
                                      Gary Wheeler
                                      wrote on last edited by
                                      #18

                                      diskpart
                                      list disk
                                      select disk #
                                      clean
                                      gpt
                                      exit

                                      Software Zen: delete this;

                                      1 Reply Last reply
                                      0
                                      • D dandy72

                                        I have a 2TB SSD that was used to run Windows (on another machine), and Hyper-V...the machine it was hooked up to died months ago, but I did continue to use the SSD in an external USB dock to run the VMs. I have no use for the Windows installation on the drive; I'm not booting from it. So I tried to get rid of everything but the VMs. My god, is it ever an adventure to try to get rid of the existing Program Files, Program Files (x86), ProgramData and Windows folders - even though Windows is NOT running from that disk. Taking ownership of folders, making sure the new ACL applies to child items (files *and* folders), deleting what you can, repeating for whatever Explorer refused to delete the first time around, etc. At this stage, it would've been faster to move the 1.7+ TB worth of VMs on it to another drive, reformat it, and copy the files back. If I was trying to delete folders owned by the OS that is currently running - obviously that's bound to fail. But the OS is on a *data* drive; it *ought* to be easy to take ownership of folders, and delete the whole thing. But nope. I've also been tempted to convert from NTFS to FAT32 (that *will* get rid of all folder permissions), and then back...but that would probably be even slower than moving the data I care about, reformatting, and recopying the files... Anyone's been down that road?

                                        S Offline
                                        S Offline
                                        ShawnVN
                                        wrote on last edited by
                                        #19

                                        I too got tired of this problem and wrote a little cmd line tool for this.. GitHub - windojitsu/OwnAndResetAcl: Reclaim ownership and control of a directory tree.[^] OwnAndResetAcl A sanity-saving tool for dealing with those pesky "Windows.old" directories Reclaim ownership and control of a directory tree. Recursively takes ownership and resets the ACLs of files, directories and symbolic links. Does NOT follow reparse-points (symlinks or junctions). DOES reclaim ownership and restore access to symlinks and junctions. DOES support traversing/accessing long pathnames. DOES include hidden/system files and directories, and empty directories. DOES NOT modify timestamp or attributes of any files/directories. USE WITH EXTREME CAUTION: Everything in and under the target directory will be owned by the 'Builtin\Administrators' group, and have a DACL which explicitly grants Everyone full-control.

                                        D 1 Reply Last reply
                                        0
                                        • S ShawnVN

                                          I too got tired of this problem and wrote a little cmd line tool for this.. GitHub - windojitsu/OwnAndResetAcl: Reclaim ownership and control of a directory tree.[^] OwnAndResetAcl A sanity-saving tool for dealing with those pesky "Windows.old" directories Reclaim ownership and control of a directory tree. Recursively takes ownership and resets the ACLs of files, directories and symbolic links. Does NOT follow reparse-points (symlinks or junctions). DOES reclaim ownership and restore access to symlinks and junctions. DOES support traversing/accessing long pathnames. DOES include hidden/system files and directories, and empty directories. DOES NOT modify timestamp or attributes of any files/directories. USE WITH EXTREME CAUTION: Everything in and under the target directory will be owned by the 'Builtin\Administrators' group, and have a DACL which explicitly grants Everyone full-control.

                                          D Offline
                                          D Offline
                                          dandy72
                                          wrote on last edited by
                                          #20

                                          Y'know...I had actually given some thought to writing a utility or script to do exactly this, but I figured it ought to get more complex than I might have anticipated from the get-go. Thank you *very* much for the link, I'll be sure to check it out as soon as time permits.

                                          S 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups