2024-1 Operating Systems (ITP30002) - HW #1
A homework assignment to copy files and directories, just like the cp
command in Linux, but simpler using C language.
Hyunseo Lee (22100600) [email protected]
This program is written in C language on Ubuntu 22.04.1 LTS. To build this program, you need to use Ubuntu 22.04.1 LTS with GCC and Make installed.
After unarchiving the folder, you should see the following files:
$ ls
Makefile README.md main.c
To build the program, run the following command in the terminal:
$ make
To build the program with debug mode, run the following command in the terminal:
$ make debug
To cleanup the build files and test files, run the following command in the terminal:
$ make clean
You can also generate the test files by running the following command in the terminal:
$ make testenv
To run the program, run the following command in the terminal:
$ ./copyfile <Options>
copyfile supports the following options:
$ ./copyfile -f <Source File> <Target File>
$ ./copyfile -m <Source File 1> <Source File 2> ... <Source File N> <Target Directory>
$ ./copyfile -d <Source Directory> <Target Directory>
You can use verbose mode with each option by adding v
option at the end of the command. For example:
# Copy source file to target file with verbose mode
$ ./copyfile -fv <Source File> <Target File>
# Copy multiple source files to target directory with verbose mode
$ ./copyfile -mv <Source File 1> <Source File 2> ... <Source File N> <Target Directory>
# Copy all files and directories from source directory to target directory with verbose mode
$ ./copyfile -dv <Source Directory> <Target Directory>
You can also see the usage explained above by running the following command in the terminal:
$ ./copyfile -h