Answer the question
In order to leave comments, you need to log in
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
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
Answer the question
In order to leave comments, you need to log in
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-...
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 questionAsk a Question
731 491 924 answers to any question