File System - Traversal (Query)

> File (System, Transfer, Storage)

1 - About

Because a file system is a tree structure, when you want to query it, you perform a Tree - (Traversal|Search) which is therefore a recursion

3 - Example

Pseudo code

function scanDirectory(directoryPath){
   for (childrenPath in directoryPath) {
        if (childrenPath is a directory) {
            print("A directory was found"+childrenPath);
            scanDirectory(childrenPath); // the recursion
        } else {
           print("A file was found"+childrenPath);
        }
}
 
scanDirectory("."); // Scan the current directory
Advertising