How to resolve the algorithm Walk a directory/Recursively step by step in the FutureBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Walk a directory/Recursively step by step in the FutureBasic programming language

Table of Contents

Problem Statement

Walk a given directory tree and print files matching a given pattern.

Note: This task is for recursive methods.   These tasks should read an entire directory tree, not a single directory.

Note: Please be careful when running any code examples found here.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Walk a directory/Recursively step by step in the FutureBasic programming language

Source code in the futurebasic programming language

include "NSLog.incl"

void local fn EnumerateDirectoryAtURL( dirURL as CFURLRef )
  NSDirectoryEnumerationOptions options = NSDirectoryEnumerationSkipsPackageDescendants + ¬
  NSDirectoryEnumerationSkipsHiddenFiles
    
  DirectoryEnumeratorRef enumerator = fn FileManagerEnumeratorAtURL( dirURL, NULL, options, NULL, NULL )
  CFURLRef url = fn EnumeratorNextObject( enumerator )
  while ( url )
    if ( fn StringIsEqual( fn URLPathExtension( url ), @"fb" ) )
      NSLog(@"%@",url)
    end if
    url = fn EnumeratorNextObject( enumerator )
  wend
end fn

fn EnumerateDirectoryAtURL( fn FileManagerURLForDirectory( NSDesktopDirectory, NSUserDomainMask ) )

HandleEvents

  

You may also check:How to resolve the algorithm 99 bottles of beer step by step in the Simula programming language
You may also check:How to resolve the algorithm String append step by step in the Julia programming language
You may also check:How to resolve the algorithm Permutations step by step in the FutureBasic programming language
You may also check:How to resolve the algorithm Factorial step by step in the Lang5 programming language
You may also check:How to resolve the algorithm Empty string step by step in the FreeBASIC programming language