C# Program to Check the Information of the File Last Updated : 01 Nov, 2021 Comments Improve Suggest changes Like Article Like Report Given a file, now our task is to view the information of this file through C#. So to do this task we use FileInfo class. This class provides different types of properties and methods for creating, copying, deleting, opening, and moving files. It is also, used for creating FileStream objects. So here we create an object of the FileInfo class which contains the file name. Syntax: FileInfo info = new FileInfo("C:\\sravan\\data.txt"); Example: In this example, we consider a file named " data.txt" present in the "sravan" folder in the C drive or "C:\\sravan\\data.txt". Now with the help of this path, we will find the information of "data.txt" file using the Attributes property. This property returns an enumerated constant which is encoded as enum flag. C# // C# program to display the information of file using System; using System.IO; class GFG{ static void Main() { // Get the file FileInfo information = new FileInfo("C:\\sravan\\data.txt"); // Get the file information FileAttributes attributes = information.Attributes; // Display file information Console.WriteLine("Attribute of the File is {0}", attributes); } } Output: Attribute of the File is Archive Comment More infoAdvertise with us Next Article How to Run C program in Ubuntu S sravankumar_171fa07058 Follow Improve Article Tags : C# CSharp-programs Similar Reads Shell Script to Perform Operations on a File Most of the time, we use shell scripting to interact with the files. Shell scripting offers some operators as well as some commands to check and perform different properties and functionalities associated with the file. For our convenience, we create a file named 'geeks.txt' and another .sh file (or 5 min read Shell Script to Read Data From a File File reading is quite an important task in a Programmer's life as it makes some tasks quite comfortable and automates certain repetitive and time-consuming things. File reading is quite an interesting concept to learn as it gives insight into quite a lot of things that can be done in the Programming 3 min read Perl | eof - End of File Function The eof() function is used to check if the End Of File (EOF) is reached. It returns 1 if EOF is reached or if the FileHandle is not open and undef in all other cases. Syntax: eof(FileHandle) Parameter: FileHandle: used to open the file Returns: 1 if EOF is reached Cases: eof(FileHandle) : Passing Fi 2 min read How to Run C program in Ubuntu Learning to run a C program in Ubuntu is a great first step for anyone starting their programming journey or switching to a Linux-based system. Ubuntu offers a clean and powerful environment to write, compile, and execute C code all from the terminal.In C, this guide will show you how to get started 4 min read Perl | File Test Operators File Test Operators in Perl are the logical operators which return True or False values. There are many operators in Perl that you can use to test various different aspects of a file. For example, to check for the existence of a file -e operator is used. Or, it can be checked if a file can be writte 3 min read How to Find Out File Types in Linux In Linux, everything is considered as a file. In UNIX, seven standard file types are regular, directory, symbolic link, FIFO special, block special, character special, and socket. In Linux/UNIX, we have to deal with different file types to manage them efficiently.Categories of Files in Linux/UNIXIn 7 min read Like