Answer the question
In order to leave comments, you need to log in
How to determine the number of objects in a directory (files and folders)?
It is assumed that you will have to scan quite large directories, and I would like to know if there are built-in tools in Linux, Windows in order to quickly find out the number of objects in a directory, or does it make sense to write a function to count files and directories yourself?
Answer the question
In order to leave comments, you need to log in
are there built-in tools in linux
It has a handy filepath.Walk function that traverses a folder tree recursively. It is enough to count calls to WalkFunc or check inside this function os.FileInfo for whether it is a file or a folder and only then count.
https://golang.org/pkg/path/filepath/#Walk
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question