Simple golang file which contains examples about file actions in golang. To keep it simple I only used golang's built-in "os" package.
- Rename any file you want to use as "main.go"
- Type command "go run main.go"
- Open file for READ, WRITE, CREATE and APPEND
- Learn GID and UID of the user
- Change user of a file with CHOWN
- Read and print file content
- Close file
- Add/append/write new data into a file
- Change permission of a file with CHMOD
- Create directory with MKDIR
- Rename file or directory with RENAME
- Remove empty file or directory with REMOVE
- Remove file or directory with any children it contains with REMOVEALL
- Change working directory with CHDIR
- Open a directory with OPEN
- List files in a directory with READDIR
- Close directory
- Learn file/directory type
- Learn temp directory with TEMPDIR
- Learn file permissions
- That's all for now...
Please use and re-use however you want.