I want to copy over all html files in a nested directory but I want to prevent the parent folders above it from being generated as well.

That is if my source path is /project/ng1/src/templates/**, I would like my generated folders to just be /templates/**.

I currently have the following command:

find projects/ng1/src/templates -name '*.html' -path pages | cpio -pdm projects/ng7/templates

But this generates the folder structure: projects/ng7/templates/project/ng1/templates/**

I would like: projects/ng7/templates/**

How do I achieve this?


Put this line into your ~/.bashrc or ~/.profile, adjust the path as needed.

export PROJECTS=/path/to/my/projects

Then open a new terminal.

$ cd $PROJECTS/ng1/src/templates
$ find . -name '*.html' -path pages | cpio -pdm $PROJECTS/ng7/templates

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.