I have this directory structure:
I want to copy the contents of the child folder to the parent folder, but I don't know how to do it with
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
You should use
sudocommand before the commands if you are copying files that are owned by ROOT or someone else.
To copy the all the files from the current folder to the parent folder, there are plenty of ways to do that.
. means current folder.
.. means parent folder of the current folder.
* means copy everything from the current folder (wildcard).
-R means copy folders and files in inside them recursively.
1) Easiest way to do this:
cd /path/to/child/directory cp ./* ../ -R
2) By providing exact path:
cp /path/to/child/folder/* /path/to/parent/folder -R
If you are not sure what is your parent directory, and you are in the child directory, follow this command to get the path of the parent directory.
Print Working Directory.