35
15
How do you copy all the contents of one directory into another?
For example:
$ cd /home/newuser
$ cp -a /backup/olduser/* .
The problem with the above is that the globing pattern '*' matches the hidden directories '.' and '..' and you end up with a directory 'olduser' inside 'newuser', as well as the contents.
You could also do something like this:
$ rmdir /home/newuser
$ cp -a /backup/olduser /home/newuser
But what if newuser already contains some default files and directories?
What is the simplest, most correct, easiest to remember and not mess-up way to move the contents of one directory to another using just the basic 'cp' command and the shell?
Great answer to this question here on AskUbuntu: https://askubuntu.com/a/86891/401660
– Josh Habdas – 2019-12-19T11:43:07.460