September 2017
Intermediate to advanced
466 pages
9h 33m
English
This subsection will create a Go program that scans a directory tree and presents files that belong or do not belong to a given user. The name of the program will be userFiles.go. In its default mode of operation, userFiles.go will display all files that belong to a given username; when used with the -no flag, it will only display the files that do not belong to the given username.
The code of userFiles.go will be presented in four parts.
The first one is the following:
package main import ( "flag" "fmt" "os" "os/user" "path/filepath" "strconv" "syscall" ) var uid int32 = 0 var INCLUDE bool = true
The reason for declaring INCLUDE and uid as global variables is that you want both ...
Read now
Unlock full access