I'm trying to write a Makefile to install the content of my folder into another on the system.

I would like to keep the same directory structure, like this.

├── a
└── b
    ├── c
        └── d
            ├── e
                └── f

I tried different options, but it does nothing

$ install -d localfolder /opt/folder
(does nothing)
$ install -t localfolder /opt/folder
install: omitting directory '/opt/folder'
$ install -D localfolder /opt/folder
install: omitting directory 'localfolder'

Can anyone point me into the right direction ? Googling 'linux install command' is not bringing any pertinent information.


2 Answers 2


For those who wants a solution, here you go: the install command doesn't work recursivly. So I wrote a shell script that does the trick.

The first argument is the folder you want to copy, and the second is the target directory


# Program to use the command install recursivly in a folder

magic_func() {
    echo "entering ${1}"
    echo "target $2"

    for file in $1; do
        if [ -f "$file" ]; then
            echo "file : $file"
            echo "installing into $2/$file"
            install -D $file $2/$file

        elif [ -d "$file" ]; then
            echo "directory : $file"
            magic_func "$file/*" "$2"

            echo "not recognized : $file"


magic_func "$1" "$2"

It is also available as a gist here


Source side of the install is files list (according to info). So, use

install source/* /destination

-d and -D options create missed directories in the destination (with difference), -t option means that destination is the directory.

With directory option it copies each source file into destination folder with source's file name


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .