Hello and welcome to the Golang programming language course.
In the previous session, we talked about check if a file or directory exists.
And in this section, we want to talk about the other files and directories concept.
Get fine information and go land.
It's that function can be used to the influence of the file and go.
This function returns is fast, which can be used to get the name of the fine size of the file in bytes.
Modify time of the file and permission bits or mode of fine.
Now you can see the scene techs, this function takes in the named file and return fire and infrastructure,
which defines the utility method to get above information.
Now let's go to this school with program to illustrate how to get find information.
First, create a file and named it 10 30 60.
So define two variables like file and error calling equals.
Invoke, create function from always package or start.
Create function and set name 10 Dot T60.
Now you check the print message for us if there is not empty, if they're not equals to Neal.
So like the throttle and set, oh, now we want to write something to the file by the following his
statement.
So we write file dots, write a string and set a message as if string parameter, for the example,
is welcome to go programming language and set back slash.
And now we get this.
That's of the file using this that function, which returns defined infrastructure describing fine.
So first, we defined two variables like that, and a roll call equals invokes that function from with
the case.
Start, start and set name of fine tend to and check to print a message for us if the error is not empty,
if they're not equals mean.
Launched that baton and set off now we print estimates of the file by calling fine infrastructure functions
for the example for the term ashes.
We're right if.
Share person is back and and said this that got mode
and for the size of fine, we can size function if earth size person the bank is close and said it's
the that size and for the name, the coin name function from stats, if any person is back and said
is that?
Dot's name and for the modification time we call mod time fonts, and if if modification time person
is back is and sets its start that much time and finally close, define so five.
The clothes reform and they called Save the Project and execute the program.
We can see the output first.
We could create a file like 10:40.
Then we wrote the information inside it and then by calling the stealth function the access and object
from defined infrastructure.
And then we fetched defined information calling function, functional fine infrastructure from object,
so we can see television size, name and modification time in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.