What rules for writing a file name should be followed: main points

Any person who uses a personal computer every day, in one way or another, encounters objects called files, which are some containers of information that serve different purposes. But far from every user fully knows what rules for writing a file name should be followed, because of which errors and misunderstandings can very often arise. Now we will consider the question regarding the file name in the most direct way.

What the file name consists of

Let's start with a description of the object itself, called a file. Here you need to clearly understand that the designation of such an information unit consists of two parts: name and extension.

what rules for writing a file name should be followed

The name, of course, can be arbitrary, but the extension indicates the type of file and largely determines what it is intended for. So, for example, everyone knows that executable files on Windows operating systems basically have the extension .exe, .bat, .sfx, etc. Graphics are presented as objects with the extensions .bmp, .jpg,, jpeg, .png and by others. Audio information corresponds to files such as .wav, .mp3, .wma, .ogg and others. The video is represented by .avi, .wmv, .mov, .mkv, .ts, etc.

However, no matter what extension the file has, there are certain files and restrictions regarding their names. Which ones, weโ€™ll see now.

What rules for writing a file name should be followed

To begin with, it is worth noting that the rules for assigning a name to a specific object directly depend on which operating and file systems are used on the computer. Moreover, not in every โ€œOSโ€ the file names will look the same. First, let's look at Windows with FAT and NTFS file systems.

Characters

In such systems, you can name the files as you like. However, it should be borne in mind that it is categorically unacceptable to use some special characters such as a colon, a slash or a vertical bar, a question mark, triangular brackets, an asterisk, etc. Some "specialists" say that, like the above characters, names cannot be used in which contain quotation marks. Nothing like this! The restrictions apply only to the character that is used in the English keyboard layout (โ€œ). "Russian" quotation marks ("") can be set easily.

The maximum number of characters in a file name

Now a few words about the total number of characters and letters that can be contained in the name of any object. In the case of the latest "operating systems" of the Windows family, the total length of the file name cannot exceed the maximum value of 255 characters. This, by the way, is in excellent agreement with the counting of bits of information needed for each particular item.

Each character, punctuation, digit, or letter is stored as one byte or eight bits. Thus, if the name consists of ten characters, the name itself will occupy 80 bits. This rule is the same for all systems.

file name length

However, the number of characters when displaying files of the same type in different operating systems may vary. The simplest example is viewing files created in Windows using the Norton Commander file manager in the DOS system, only a few initial characters remain in the name, after which the โ€œ~โ€ sign is automatically set. The same changes can be observed in some other operating systems. For example, if you look at the name of a file that is not a Windows application or does not match any of the supported types, the name is reduced to the first six characters without spaces.

Change file names

Now, in the question of what rules for writing a file name should be followed, let's go even further. As already clear, if the maximum number of characters in the file name is exceeded, say, if renaming occurs, and sometimes copying or moving, the system simply cannot save it in a new form. An error like โ€œFile name too longโ€ will simply appear on the screen.

file name is too long

It goes without saying that you cannot change extensions, even if the user tries to rename files of the same type (for example, save Word text documents in PDF format). For this you need to use special tools. You can rename in this way unless the text file is .txt, changing the extension, for example, to .bat (executable file). However, if commands are not spelled out in the text, the file will be opened in the usual Notepad, that's all. If the commands are present and written with the correct syntax, the file will be executed, if not in the background, then like what we see when we start the command line or when working in an outdated DOS system.

By the way, if we look at the question of what rules for writing a file name should be followed in full detail, it can be noted that many programs for recovering information deleted from the Recycle Bin use the principle of searching by name. The fact is that when you delete the file is not physically erased from the hard drive, only the first character is changed to the "$" sign. If the sector containing such information was not overwritten, the system recognizes the file as suitable for recovery.

Source: https://habr.com/ru/post/C17099/


All Articles