V
V
Vitaliy Semyanchuk2015-01-28 13:13:07
ubuntu
Vitaliy Semyanchuk, 2015-01-28 13:13:07

How to copy data across folders while maintaining folder hierarchy (ubuntu)?

Hello.
The task is to copy the changed files to a separate folder.
To do this, I get the files that I need to copy via git git diff --name-status branch1 branch2

M       web-app/templates/path1/file1.html
M       web-app/templates/path1/file2.html
M       web-app/templates/path1/file3.html
M       web-app/templates/path1/file4.html
M       web-app/templates/modals/file.html

and now they need to be copied to a separate deploy folder
deploy/web-app/templates/path1/file1.html
deploy/web-app/templates/path1/file2.html
deploy/web-app/templates/path1/file3.html
deploy/web-app/templates/path1/file4.html
deploy/web-app/templates/modals/file.html

Maybe someone knows how to scatter these files like this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2015-01-28
@merryjane

Of course, you can write a bash script, or you can simply submit a list of the necessary files to tar, something like this:
stackoverflow.com/questions/8033857/tar-archiving-...

M
Maxim Logunov, 2015-01-28
@spitty

You can use this one-liner to copy
cut will "cut" the second field from the strings, containing the relative path to the file.
for will loop through the received files and execute cp.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question