20.6 Copying files

At present, copying of directories is not supported; we have to create the directory and then copy files into it.

Function: mbfl_file_enable_copy

Declare the commands required to copy files and directories. Declaring the intention to use a program

The programs are: cp.

Function: mbfl_file_copy SOURCE TARGET ?…?

Copy the SOURCE, a file pathname, to TARGET, a file pathname. Additional arguments are handed to the command unchanged.

If SOURCE does not exist, or if it is not a file, an error is generated and the return value is 1. If TARGET exists an error is generated and the return value is 1.

Function: mbfl_file_copy_to_directory SOURCE TARGET ?…?

Copy the SOURCE, a file pathname, into the directory TARGET. Additional arguments are handed to the command unchanged.

If SOURCE does not exist, or if it is not a file, an error is generated and the return value is 1. If TARGET does not exist or it is not a directory: an error message is generated and the return value is 1.

Function: mbfl_exec_cp ARG

Execute the program cp using the given optional command line arguments.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.