Skip to content

Instantly share code, notes, and snippets.

@lewis-munyi
Last active April 29, 2021 12:25
Show Gist options
  • Select an option

  • Save lewis-munyi/b7fd9f0a27a33facaa2f8a5a4d80e309 to your computer and use it in GitHub Desktop.

Select an option

Save lewis-munyi/b7fd9f0a27a33facaa2f8a5a4d80e309 to your computer and use it in GitHub Desktop.
Enable file name Case sensitivity for Windows [Python script]
# Recommended: Run file as administrator
import os
import time
start = time.time()
pwd = os.getcwd()
y = 0
for x in os.walk("."):
clean_link = x[0][2:]
arr = clean_link.split("\\")
exceptions = ['.git', 'node_modules', 'vendor', 'public', 'dist', "__pycache__", "pip", "Lib", ".NET", ".nuxt"]
if any(link in exceptions for link in arr):
continue
else:
y += 1
path = f"{pwd}\{clean_link}"
os.system(f"\tfsutil.exe file setCaseSensitiveInfo \"{path}\" enable")
print(f"\tfsutil.exe file setCaseSensitiveInfo \"{path}\" enable")
end = time.time()
print(f"Program has enabled Case sensitivity for {x} folders in {end - start} Seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment