I have 2-3 levels and several folders but in all is a file with the name L_data.txt
(among other files). I would like to copy only those L_data.txt
together with their parent folders without any of the other files to another place. How can I do that?
E.g.:
./PycharmProjects/folderA/L_data.txt
./PycharmProjects/folderB/L_data.txt
.
.
./PycharmProjectsCluster/folderQ/L_data.txt
./PycharmProjectsCluster/folderR/L_data.txt
.
.
I have found this post and this post but that moves all files without the folders. Thanks for help.
find . -name L_data.txt
works but when I use the full command, it freezes and does not copy. – My Work Jun 22 '20 at 12:17find . -name L_data.txt -exec cp --parents -t new_dir/ {} \;
instead of the proposed seems to work. Then I have another problem with thefind
itself with which I do not want to spam here. Thanks again. – My Work Jun 23 '20 at 19:06