How to take ownership permissions in a folder on Windows 10

I just had a problem deleting a folder in Windows 10. supposedly I didn’t have the proper permissions to do so.  first I tried to delete the folder from the file explorer, but it gave me an access denied error. then I tried from the command line using this command rmdir c:Windows.old /s but it gave me the same error.
the folder I’m trying to delete was created by Windows 10 when I upgraded the computer. Somehow windows 10 saves the previous operating system, just in case you want to downgrade if you don’t like Windows 10.

I don’t need to downgrade, so how do I delete that old windows folder? It seems like I need to take ownership of that folder first. by default, the system user is the owner. taking ownership of a file or folder is a bit different in Windows 10 than in previous Windows releases. to take ownership do this:

Right-click the directory, and go to Properties:

 image

then click on the Security tab and click on the Advanced tab.

imageimage

On the next Window, click on Change right at the top:

image

Add your username on the window that pops up next:

image

Click on Check Names and then click on OK.

click on Yes or OK in any Window pop-up you might get.

Now you should be the owner of such folder, and should be able to delete it like I did.