0

I have a web project with the following structure:

application/
dumps/
nginx/
logs/
.git/
docker-compose.yml
Dockerfile
README.md
.gitignore

For several reasons, I would like to dissolve the application folder and copy all files to the root directory. I would like to do this as usual via the CLI. However, I am not getting anywhere at the moment.

I have tried the following. I am in the root of the project.

cp -r application/ ./
// output cp: 'application/' and './application' are the same file

cp -r app/. ./ // copy only the root files from application to the project root and not the folders.

Which is kind of logical. How do I formulate the command so that it only copies the files to the root? It's probably just a small thing but it's too early for me.

2 Answers2

1

Ok. I got it. It was really to early ;-) The right command would be:

cp -a app/. ./

And better to use -a option instead of -r option. It is an improved recursive option and means, that preserve all file attributes, and also preserve symlinks. Found it: How can I copy the contents of a folder to another folder in a different directory using terminal?

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

-1

You just need a wildcard at the end of the command like so:

cp -r application/* ./
Nate T
  • 1,590