If you have ever copied a file from another Windows system on to an external hard, you may have run into a problem where you cannot access the files or directories. That is, Windows does not allow you to change directory or even if you could, will not allow you to read files in that directory.
This happened to me when I copied several video files from my Windows tablet, to an external hard drive. When I tried to watch the videos on a Windows 10 system, I got an error.
At first I thought the files were corrupt. After some investigation, I determined that it was a permissions issue.
Windows did help by providing hints and a method to take ownership of the files or folders but only one at a time. You do this by opening multiple windows, choosing a user name, and clicking several buttons. The fix is very tedious.
I had hundreds of files to fix so I needed a quicker solution. After searching, I found a solution that uses a Windows command window to change multiple files at a time.
Follow These Steps to Take Ownership
To fix the problem, you just need to learn and execute two commands.
First open a command window with elevated privileges
- right click the windows icon on the bottom left then select Command Prompt (Admin)
- go to the parent directory that you want to fix.
Third, execute the following command to recursively take ownership of files in the current directory.
- takeown /f .\* /R
Fourth, execute the following command to recursively set the permissions to Full Control in the current directory.
- icacls .\* /grant <User Name>:(OI)(CI)F /T
After taking control and setting the permissions, you should be able to copy, view, modify, or delete these files.
If all your files are under one directory, a folder in windows parlance, then you can fix all the files with just two commands. Even if that is not the case, this command line method beats the graphic method hands down.
If you have a comment, please leave a message below. For computer science videos, please subscribe to my Translation Data YouTube channel.
You can follow me on twitter @HaroldAlmon or @TranslationData.