Getting Your Windows Files And Folders To Behave As On Linux

React Developer (Freelance) external link
🔗 See other jobs


I will make this brief.

If you write software on a Windows machine but usually deploy on a Linux server you probably have encountered the problem of your software breaking due to the difference in the way both OSs handle file names and the issue with referencing the wrong case of the name in your code.

Basically, you can get away by reference index.js as Index.js on Windows but not on Linux.

To get your directories and files to behave on Windows as they would on Linux. Open PowerShell navigate within your project directory and run the following script.

(Get-ChildItem -Recurse -Directory).FullName | ForEach-Object {fsutil.exe file setCaseSensitiveInfo $_ enable}

This will enable case sensitivity for when you referenc a file/folder name in your code or if namespacing depends on file and folder names like in PHP.

This way if you mix up the case of your file you won't be forgiven even on Windows because Linux won't either. I got this script on StackOverflow but I am still looking for the source. I will add that bit when I find it. I kept the above script in a Gist a while back for when I need it and felt I should share it.

Here is another article you might like 😊 "Trimming the fat off Bootstrap 4"