Hello and welcome to the golden programming language course in the perilous.
We talked about of all phones and directories in Golden.
And in this section, we want to talk about the other files and directories concept.
Iterate over on phones and folders for a pass like function offering the pass package can be used to
recursively iterate over on phones and folder in the directory tree.
What function gets the rules passed as argument and will walk the entire two route it at the rules passed
include all subdirectories and gets the watch funk as argument and will be called for.
Read the parts of the file folder and find info or the it or if any animal occured while walking that
fine folder.
Now you can see this scene takes some things to note about what function.
All errors are filtered and errors might arise while opening.
Define the function does not follow symbolic links, and the finds are locked in the Lexicon order.
Now, let's go to the school program to illustrate how to iterate over all files and folders for a pass.
First, we create a folder named sampler.
And create to find inside it named Test one and test to.
Test one that takes the.
And test to get to 60 and then create a folder named Tent Von in sample directory.
Ten point.
And then inside tampon, create another file like this three, the dentist 4.60.
This three that takes the.
And test for Tom T60.
OK, so go to main function.
First, we used to get W D function, this function returns a routed past name corresponding to the
current directory.
If the current directory can be reached via multiple paths, get W d may return any one of them.
So first, define two variables.
Current directory and narrow column equals.
And we'll get WD function from oil spike, it will start get w d
Cheikh error message if.
They're not equals to me.
So paint a message for lock the baton.
And of
now create an E-Trade function that accept a passive string as argument.
So go alotof main function and create a function like form.
Iterate and sit a string as a pass has a string.
Now, we can't want function from foreign press package and initialize it fine pass.
What function
it gets to our humans first is past, and second is a watch f and function.
So we sit pass and what if an argument fine sit pass as this strange
info as file info from voice package
and e are time is there or.
Return type is a or
go to the body and check it or eat it all not equals to Neal.
Like, don't try to laugh at or.
That air now display name of each file and folder.
Check if info is directory, so display folder name.
And if it is a fine, it prints file names.
So do the following.
Is the info don't is directory
so painful your name, F. A. the plaintiff.
Folder named person is in and sit.
Name from the info info, Courtney.
And there's.
If, if.
File name first person is back in and said your full name said return for dysfunction and close plants.
Now go to main function and call Iterate.
Go to main function.
And call it raid and said current directory as arguement reformat the code, save the project and execute
the program.
Now we can see the output folder, name phones, dash directories, fine name that go to folders, name,
sample and temp on and for Fine's name Test 1.60 until test for that text.
So we could iterate file and folders by the VOC and white Effen functions.
OK.
We have reached the end of this session.
I hope you have taken full advantage of this session onto the next session.
Goodbye.