If I have 5 or more files in a Windows Explorer folder and I rename them with a script that only changes capitalization, Explorer doesn't automatically "refresh" and show the new names in my open Explorer window. It will refresh automatically if I only rename 1 to 4 files or if I change the letters in the name to something else.
I have to manually press "F5" with the open Explorer window to see the new names. Is there a way I can make Explorer or Windows 10 refresh the directory automatically in a script so I don't have to press F5?
Here is an example batch file (rename.bat)
ren file_important_stuff_1.txt File_Important_Stuff_1.txt
ren file_important_stuff_2.txt File_Important_Stuff_2.txt
ren file_important_stuff_3.txt File_Important_Stuff_3.txt
ren file_important_stuff_4.txt File_Important_Stuff_4.txt
ren file_important_stuff_5.txt File_Important_Stuff_5.txt
It also fails to work with a simple Python script:
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)
Here's a picture of the directory with files:
foo
toFoo
and it won't recognize the change. You can movefoo
to another folder, change tobar
and then toFoo
and move it back and as long as it's relatively "instant" (<2 seconds), Explorer will not see the change.