Answer the question
In order to leave comments, you need to log in
How to recursively copy files from a list in Linux?
There is such a problem. There are many folders and files and some of them are under .svn. It is necessary to copy, keeping the structure, only files and folders that are under .svn into a separate folder. To get a list of files and folders under svn I use the command svn list > ~/file.txt . How can I get the structure of files and folders from this list only?
Answer the question
In order to leave comments, you need to log in
Since it is necessary to preserve the directory structure, you should not forget about the --parents option, otherwise you will end up with an "all-in-one-directory" mess.svn list | xargs -I % cp --parents -v % target
$ cat list.txt
one
two.txt
three.rtf
$ cat list.txt | xargs -J % echo cp % new_folder
cp one two.txt three.rtf new_folder
$ cat list.txt | xargs -I % echo cp % new_folder
cp one new_folder
cp two.txt new_folder
cp three.rtf new_folder
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question