Ubuntu – Is it bad practice for folder name to contain dot (.)? How about file name with multiple dots

directoryfilesnaming conventions

Sometimes it makes practical sense for a folder name to contain a dot (.). For example, you are storing data for an experiment conducted at L=0.5. So the folder might be named:

experiment_L0.5

A similar issue may arise for file names. For example:

file_L0.5.txt

Working in Ubuntu, is this bad practice? How about if sharing these directories with a Windows user?

Thanks!

Best Answer

As far as I know there is no issues with naming folders and files with a single or multiple dots.

Ubuntu generally does not use the dot and three characters (such as .txt) to identify the file type. So this has no special meaning in the Ubuntu context. This is useful when sharing files with Windows. Ubuntu uses Magic Numbers in the first few bytes of the file to identify the file type. However, Nautilus. ignores the magic numbers if the dot and three characters extension is available to identify the file type. This setting can be changed. See Force nautilus to ignore extensions

In Ubuntu, starting a file or folder names with a dot, such as .experiment_L0.5, makes the file or folder hidden. You can toggle the display of hidden files by pressing Ctrl+H in Nautilus. In Windows a file name starting with a . is not hidden. So if you transfer a hidden file named .experiment_L0.5 into a Windows system it will be plainly visible.

In Ubuntu a file name can end with a dot as it has no special meaning placed at the end. However, in Windows a dot separates the file name and extension, and a file name ending with a dot but no extension is not allowed. When I tried to create such a file in Windows I got a file with just the name, no dot, no extension.

Reference: Wiki on Filenames

Hope this helps.