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, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access