Ubuntu – How to copy folder’s contents and tree-structure into a remote directory with same structure

command linescpssh

Is it possible in SSH terminal to copy a folder directory into another directory that will share mostly the same folder names/structure but will have unique files.

In a simple example:

If FOLDER1 has APP > CODE > COM > FILE 1

And FOLDER2 has APP > CODE > COM > FILE 2
THEME > BAH > FILE 3

Is it possible to copy app across 'app' to 'app' so that the files will populate the existing folders and new folders that aren't present will be created in the same structure.

Basically I'm trying to install a module that I would normally do through FTP but I only have SSH access to this new server.

Using scp results in ./app: Directory not empty

Best Answer

You can use scp to upload your files to the remote machine into a separate directory, then ssh into the machine and just use cp command to copy the files from one directory to another, with something like.

cp -R /path/to/FOLDER1/* /path/to/FOLDER2
Related Question