Finding files based on their permissions

Now that you know how to find the Unix permissions of a file, you can improve the regExpFind.go utility from the previous chapter in order to support searching based on file permissions; however, in order to avoid presenting a really big Go program here without any practical reason, the presented program will be autonomous and only support finding files based on their permissions. The name of the new utility will be findPerm.go, and it will be presented in four parts. The permissions will be given in the command line as a string using the format returned by the ls(1) command (rwxr-xr--).

The first part of the utility is the following:

package main 
 
import ( 
   "fmt" 
   "os" 
   "path/filepath" 
) 
var PERMISSIONS ...

Get Go Systems Programming 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.