Developing a File System Crawler

The walk tool has two main goals: descending into a directory tree to look for files that match a specified criteria and executing an action on these files. Let’s start this tool by implementing the search and filter functionality. The only action we will implement now is listing the files. This enables us to try the tool and ensure it’s finding the correct files. You’ll implement other actions such as delete and archive later.

This initial version accepts four command-line parameters:

  • -root: The root of the directory tree to start the search. The default is the current directory.

  • -list: List files found by the tool. When specified, no other actions will be executed.

  • -ext: File extension to search. When specified, ...

Get Powerful Command-Line Applications in Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.