Last active
April 29, 2021 12:25
-
-
Save lewis-munyi/b7fd9f0a27a33facaa2f8a5a4d80e309 to your computer and use it in GitHub Desktop.
Enable file name Case sensitivity for Windows [Python script]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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