Home »
Golang Programs
Golang File Handling Programs
In Go programming language, there is a huge inbuilt library to perform file handling operations (such as writing to a file, reading from a file, renaming, moving, deleting, etc.). Reading and writing files are the basic operations needed for the Go programs and by using these inbuilt libraries, we can easily perform the file handling operations.
This section contains the solved Golang file handling programs. Practice these Golang file handling programs to learn the file handling concept, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the Golang file handling programs.
List of Golang File Handling Programs
- Golang program to create a text file
- Golang program to write and read data from a text file
- Golang program to create an empty file
- Golang program to get the size of an existing file in bytes
- Golang program to print the permissions of the existing file
- Golang program to print the last modified time of an existing file
- Golang program to check the specified file is a directory or not
- Golang program to rename a specified file with a new name
- Golang program to delete a specified file
- Golang program to open a file in read-only mode
- Golang program to open a file in append mode
- Golang program to check a specified file is exists or not
- Golang program to set file permission
- Golang program to change the ownership of the file in the Linux operating system
- Golang program to truncate the data of the file
- Golang program to create a copy of the existing file
- Golang program to commit or sync data into memory disk
- Golang program to write data bytes into a file
- Golang program to read bytes from the file
- Golang program to demonstrate the Seek() function to random access from the file
- Golang program to write data into a file in a single line
- Golang program to read data from the file in a single line
- Golang program to get the size of the file using Seek() function
- Golang program to read data line by line from file using scanner
- Golang program to read data from file word by word using the scanner
- Golang program to create an empty zip file
- Golang program to create a zip file containing a text file
- Golang program to create a temp directory in the '/tmp' directory
- Golang program to create a temp directory at the specified path
- Golang program to create a temp file in the specified temp directory
- Golang program to write a structure of binary data into the file
- Golang program to read a structure from the file
- Golang program to create a specified directory with specified permission
- Golang program to create multiple directories with specified permission
- Golang program to delete an empty directory
- Golang program to list the content of the specified directory
- Golang program to read the content of a specified directory and check directories and files