View previous topic :: View next topic |
Author |
Message |
Pretty Little Ditty n00b
Joined: 07 Oct 2005 Posts: 13
|
Posted: Wed Nov 23, 2005 12:05 am Post subject: how to copy files by a pre-made list? |
|
|
I tried to search the forum, and although I found some threads that are somehow related to my (very simple ) question, I couldn't reall understand what to do.
I already have my list of the files ready. so, Iv'e tried this:
Code: | cat list.txt | xargs -0 cp --target-dir=/home/etc..etc... |
but as you know, xargs gets the list as one big line. how do I make it read one line after the other? |
|
Back to top |
|
|
codergeek42 Bodhisattva
Joined: 05 Apr 2004 Posts: 5142 Location: Anaheim, CA (USA)
|
Posted: Wed Nov 23, 2005 12:07 am Post subject: |
|
|
Something like the following may work (untested): Code: | while read LINE; do
cp "$LINE" /path/to/target;
done < /path/to/files_list.txt |
_________________ ~~ Peter: Programmer, Mathematician, STEM & Free Software Advocate, Enlightened Agent, Transhumanist, Fedora contributor
Who am I? :: EFF & FSF |
|
Back to top |
|
|
Pretty Little Ditty n00b
Joined: 07 Oct 2005 Posts: 13
|
Posted: Wed Nov 23, 2005 12:13 am Post subject: |
|
|
Thank You!! it works. |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9555 Location: beyond the rim
|
Posted: Wed Nov 23, 2005 3:46 am Post subject: |
|
|
or a bit easier:
Code: | cp $(< path/to/filelist.txt) /targetdir |
|
|
Back to top |
|
|
|