...

/

Deleting Matched Files

Deleting Matched Files

Learn how matched files can be deleted.

Let’s make the walk tool a little more useful by adding the ability to delete the files it finds. To do this, we’ll be adding another action to the tool and a new flag del of type bool, allowing the user to enable file deletion.

Learning how to write code that deletes files is an important aspect of creating tools that work with files and perform system administration tasks, but it comes with the risk that we might accidentally delete files we didn’t intend to delete. We need to make ...