F
F
fredrsf2014-03-01 18:20:23
linux
fredrsf, 2014-03-01 18:20:23

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

3 answer(s)
@
@sledopit, 2014-03-02
@fredrsf

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

S
Stepan, 2014-03-01
@L3n1n

$ 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

F
fredrsf, 2014-03-03
@fredrsf

I did svn list -R | xargs -I % cp --parents -v % target, but folders are skipped with messages cp: omitting directory 'directory'if you specify

svn list -R | xargs -I % cp -r --parents -v % target
, then cp starts copying everything and .svn folders including

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question