How to copy Ubuntu folder contents via Putty SSH

Login to remote Ubuntu install through App ‘Putty’ using ssh using and login with the ‘root’ administrative user.

You can copy the content of a folder /source to another existing folder /dest with the command

cp -a /source/. /dest/
The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks.

The . at end of the source path is a specific cp syntax that allow to copy all files and folders, included hidden ones.

If you first need to make a new target directory/folder, then you can use the mkdir command, like this:

mkdir /home/yourusername/newtargetdir

All this is useful if you want to re-install a MySQL server that won’t start, and making backups lessen the risk of loss of database files.

MySQL database files are stored in /var/lib/mysql.  This folder ‘should’ remain untouched when you remove or re-install the MySQL package.

It is also a good idea to make a backup of those database files.  I did so using the copy command above.