I have a Python script to change the capitalization of multiple files in a directory. The problem is that I run my script but Windows Explorer doesn't show the new names unless I hit "refresh" with F5. I know Windows Explorer is essentially case insensitive so I think it doesn't recognize that there were changes to the directory if the only changes were to the capitalization.
For what it's worth, I run the script with that directory open in Windows Explorer so I expect to see the change in that opened window.
In the script, I have tried renaming the files to something intermediate (like file_important_stuff.txt to test.txt and then to the desired File_Important_Stuff.txt) but it seems that Windows 10 just compares the "before" and "after" names in the directory to decide whether to "refresh" or not. Same with moving the files to a different directory and then back within the script.
I can force the desired behavior if I use open() to open each renamed file for writing in Python but then the date modified changes, which I don't want.
Edit: Some new learning. If you rename one to four files, Windows Explorer will update. If you update 5 or more files, it doesn't refresh the window. Here is some same code:
import os
for x in range(1,6):
fileNameOld = "file_important_stuff_" + str(x) + ".txt"
fileNameNew = "File_Important_Stuff_" + str(x) + ".txt"
os.rename(fileNameOld,fileNameNew)
import os moduleand addos.system('gpupdate/force')to force a system refresh