Files & Folders In C#

One of the ways of permanent storage of data is through files. A file is a collection of data stored on a secondary storage device, such as the Hard Disk. Every file has a name associated with it, such as CSITquestion.txt. The name comprises of two parts the base name (in our case ‘CSITquestion) and the extension (txt).
The portion before the period (.) is the base name whereas the one after it is the extension. A file name can also contain multiple periods – The most significant period is always the last one. So, in this case, the base name of the file would be and the extension txt.
The extension determines the type of the file. For example, a word document has an extension of doc while an excel file has an extension of xls. The base name is what we specify to identify that particular file.
Files are contained in folders or directories. A directory itself can contain other files and folders, thus forming a hierarchy. Files within a folder (directory) need to have unique names. Files with same base name but different extensions are allowed. So, the file My File.txt and My File.doc can co-exist in the same folder.
The full path of the file contains its complete address on a machine. For instance, if the file Notepad.exe is contained inside the Windows directory of your C drive, its path would be “C:\Windows\Notepad.exe”. Likewise, if it were to be contained inside the System32 directory which in turn is present in the Windows directory, the full path would be “C:\Windows\System32\Notepad.exe”.
Note: No two files on your computer can have the same full path.
Scroll to Top