Sometimes, when Windows 10 is updated, a number of files become inaccessible. Use the icacls command to regain access to this files.
After applying an update to Windows 10, in October 2016, my Windows temporary directory was updated such that I re-encountered some of the problems I’d experienced earlier in the year. When I fixed the problem I didn’t write down the actions that I’d taken to restore access to my own files. This time I did.
In each directory where files are not accessible I typed two commands
takeown /F *.jpg /A icacls * /grant QW:(OI)(CI)F /T
You also have to give yourself access to the System windows temporary directory identified by environment variable
TEMP. In my case, on
QW the directory was
If you don’t do this then the original file, when copied to the uploads directory, will not be accessible. In explorer you won’t see its thumbnail.
Another way to fix the problem would be to take a look at the options in get_temp_dir().
I found some answers using StackOverflow. The older answers only mentioned
cacls. The updated ones referred to
takeown. Whether or not I needed to run
takeown I don’t really know. I hope I won’t have to revisit this again in the near future.
Problem revisited – Jan 2020
… It’s happened quite a few times since. Today I noticed a problem with attachments that had not been cloned to oik-plugins.co.uk. I discovered that the target files were 0 bytes. When I attempted to ftp the original files ( into wp-content/uploads/2019/10 ) it failed because Filezilla could not access the source files.
On my new machine (
SB) I now run a simple batch command
ic.bat. Note: This has to be invoked from a Command Prompt started with Run as administrator.
icacls * /grant SB:(OI)(CI)(F) /T
Temporary files folder
SB the settings of
TMP environment variables point to a different folder.
The folder currently contains files that I didn’t really expect to be there.
- Many folders named
phpcs_temp.tmpnnnnwith subfolders containing nothing. These are associated with PHPCS and PHPCS Fixer, which are run by PHPStorm. See https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html
- A load of 0 bytes files named
mat-debug-nnnn.log; one every 15 to 20 minutes. These may be related to Microsoft Application Telemetry.
- And some files I might have expected to see.
By the way. I still don’t know whether or not I should run `ic.bat` against this directory. I have just done so. Let’s see if this makes any difference.
Original problem: H2GD Part 54: Windows 10 butterfly effect