bashgit-bashhyperterminal

why does touch .fileName does'nt create a hidden file?


I'm trying to create a hidden file and for some reason the command touch .fileName doesn't work. I made sure that my folder and file settings are set to - don't show hidden folders and files. I'm working with windows10, and Hyper.is terminal.


Solution

  • Windows doesn't care about files beginning with a dot. It just treats them like any old file. If you want to hide a file in Windows you must (also) change that attribute.

    attrib +h path-to-file 
    

    You can run that from any cmd or PowerShell prompt. It may also work at a bash prompt, though I don't have one in front of me to test it. Using that dual method you can name your file .whatever and then add the above attribute and make it hidden to Windows as well. (Bash should treat the .whatever file as hidden regardless of the Windows attribute.)