Can't delete Windows and all Program-files-files(x86)-data folders why


  1. Posts : 39
    Microsoft Windows 10 Home
       #1

    Can't delete Windows and all Program-files-files(x86)-data folders why


    In D: drive i have the old windows. I didn't uninstalled them i just installed new windows on C:
    The drive D: was C: but now the drives switched.

    Now in C: i have the new installed windows 10 and it's working fine.
    But on D: i have the old windows folder and also the folders: Program Files, Program Files(x86) and ProgramData

    And when i try to delete all this 4 folders i'm getting in each one of them a message:

    Can't delete Windows and all Program-files-files(x86)-data folders why-untitled.jpg

    This is how i'm trying to delete:

    Can't delete Windows and all Program-files-files(x86)-data folders why-untitled1.jpg

    In this case the Program Files folder but the same message i'm getting on the other folders.
      My Computer

  2. FreeBooter's Avatar
    Posts : 4,027
    Windows 10 Pro 64-bit
       #2

    You need to give yourself a full permission and take ownership of the folders.

    1. In Windows 10 type cmd.exe into Start Menu, right-click on Cmd.exe, and open it as an administrator.

    2. Type following commands:

    Code:
    Takeown  /f  D:\Windows /r  /D Y
    
    Takeown  /f   "D:\Program Files"  /r  /D Y
    
    Takeown  /f   "D:\Program Files(x86)"  /r  /D Y
    
    Attrib  -s  -r  -h  D:\ProgramData
    
    Takeown  /f   D:\ProgramData  /r  /D Y
    
    Icacls  D:\Windows  /grant  %Username%:F   /t   /c
    
    Icacls  "D:\Program Files"  /grant  %Username%:F   /t   /c
    
    Icacls  "D:\Program Files(x86)"   /grant  %Username%:F   /t   /c
    
    Icacls  D:\ProgramData  /grant  %Username%:F   /t   /c
    After executing the commands try deleting the folders.
      My Computer


  3. Posts : 39
    Microsoft Windows 10 Home
    Thread Starter
       #3

    Could you explain please what are the commands do and why did you make attrib only for programdata but not the other directories ? And if i have a directory or file that is not related to one of this directories what should i do ?
      My Computer

  4. FreeBooter's Avatar
    Posts : 4,027
    Windows 10 Pro 64-bit
       #4

    The Takeown command allows an administrator to recover access to a file that was denied by re-assigning file ownership.

    Below command gives your user account ownership of the Windows folder and files/subfolders of the Windows folder.

    Code:
    Takeown  /f  D:\Windows /r  /D Y
    The Attrib command displays or changes file/folder attributes.

    Below command clears hidden, read only and system attributes of the ProgramData folder this is done because Takeown command cannot take ownership of the hidden folder/file. The D:\ProgramData folder by default is hidden.

    Code:
    Attrib  -s  -r  -h  D:\ProgramData

    The icacls command is use for modifying or displaying files/folders NTFS permissions.

    Below command given your user account full permission to Windows folder and its files/subfolders.

    Code:
    Icacls  D:\Windows  /grant  %Username%:F   /t   /c
      My Computer

  5. SIW2's Avatar
    Posts : 1,712
    trying to install win10
       #5

    You can delete them from booted winpe/winre.
      My Computer

  6. spunk's Avatar
    Posts : 2,897
    Windows 10 Pro 64 Bit 20H2
       #6

    Rather then trying to Delete Windows System files, why not save any personal files under D:\Users\[YourUserName] (ie) Documents, Pictures, Music, to a different drive, like your C:\ Windows 10 drive, and then Format the D:. drive. Once that is done, you can restore your personal files back to D: as a backup.
      My Computer


  7. Posts : 39
    Microsoft Windows 10 Home
    Thread Starter
       #7

    spunk said:
    Rather then trying to Delete Windows System files, why not save any personal files under D:\Users\[YourUserName] (ie) Documents, Pictures, Music, to a different drive, like your C:\ Windows 10 drive, and then Format the D:. drive. Once that is done, you can restore your personal files back to D: as a backup.
    I have on D: too much data like movies programs and other stuff more then 300GB it will take me too much time to copy it and on C: it's the new windows installation C: is smaller hard disk. Deleting the old windows from D: in this case at least is the faster way.
      My Computer

  8. f14tomcat's Avatar
    Posts : 53,629
    Multi-boot Windows 10 - RTM, RP, Beta, and Insider
       #8

    The simplest and safest way to "Take Ownership" of a folder or file is to use the context menu option provided in this TF tutorial. Then right click the folder or file in question, and click Take Ownership. You then own it, and can move/copy/delete/modify anything you wish. Just be cautious, it does exactly what it says. Use wisely.

    Add Take Ownership to Context Menu in Windows 10 User Accounts Tutorials

    TC
      My Computers


 

  Related Discussions
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 04:32.
Find Us




Windows 10 Forums