Windows.old folder won't delete

Discussion in 'Windows 10' started by ratsalad, Aug 27, 2021.

  1. ratsalad

    ratsalad MDL Novice

    Feb 27, 2010
    40
    3
    0
    How does one delete the windows.old folder ?
    Tried disk clean and changing permissions.

    Thanks.
     
  2. javaspain

    javaspain MDL Member

    Jul 29, 2009
    191
    98
    10
    #3 javaspain, Aug 27, 2021
    Last edited by a moderator: Aug 27, 2021
    The short script has only 3 rows.
    Code:
    TAKEOWN /F %SystemDrive%\Windows.old /A /R /D Y
    ICACLS %SystemDrive%\Windows.old /T /grant :r Administrators:F
    RD /S /Q %SystemDrive%\Windows.old
    

    Powershell script:
    Code:
      $regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations"
        New-ItemProperty -Path $regpath -Name "StateFlags1221" -PropertyType DWORD  -Value 2 -Force  | Out-Null
        $regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\update Cleanup"
        New-ItemProperty -Path $regpath -Name "StateFlags1221" -PropertyType DWORD  -Value 2 -Force  | Out-Null
        $regpath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error memory dump files"
        New-ItemProperty -Path $regpath -Name "StateFlags1221" -PropertyType DWORD  -Value 2 -Force  | Out-Null
        #start clean application
        cleanmgr.exe /SAGERUN:1221
    
     
  3. ciyive9642

    ciyive9642 MDL Novice

    Jun 7, 2020
    28
    10
    0
    Restart your machine and try disk cleanup again.
     
  4. ratsalad

    ratsalad MDL Novice

    Feb 27, 2010
    40
    3
    0
    Nothing works that was posted here.
    Thanks anyway
     
  5. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,274
    94,761
    450
    Get nsudo, start it, type cmd and run
    Code:
    rd /s /q \\?\C:\Windows.old
    
     
  6. ratsalad

    ratsalad MDL Novice

    Feb 27, 2010
    40
    3
    0
    Still not working
     
  7. Mr.X

    Mr.X MDL Guru

    Jul 14, 2013
    8,575
    15,646
    270
    chkdsk C: /r
     
  8. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    47,274
    94,761
    450
    Show us the error.

    I recently wanted to cleanup a leftover mount folder (when testing the new W10UI and MUI scripts), it took me over 2hrs doing it manually, by rebooting to safe mode and deleting the files, by booting into to winre environments, and ended up in taking over ownerships for every file that didn't want to be deleted.

    After that @abbodi1406 showed me the nsudo method and the folder was gone in a few seconds.
     
  9. ratsalad

    ratsalad MDL Novice

    Feb 27, 2010
    40
    3
    0
    C:\Windows.old\WINDOWS\appcompat\Programs\Install - The directory is not empty.

    (The directory is empty)
     
  10. VuXuanHoang2003

    VuXuanHoang2003 MDL Novice

    Jul 23, 2021
    7
    1
    0
    use "Take Ownership" reg file
     
  11. TigTex

    TigTex MDL Senior Member

    Oct 5, 2009
    454
    358
    10
    Usually I run 7zip as admin, and using shift+delete I can delete any folder with that stupid "directory is not empty" error.
     
  12. ratsalad

    ratsalad MDL Novice

    Feb 27, 2010
    40
    3
    0
    Nothing has worked.
    I do thank all that replied
     
  13. You are Most Welcome & I am saying Thanks to You.