cp command with input from a text file
I have a file, in inside has a long list of full paths to different file.
e.g. Code:
/etc/asdsad/filename I want to copy all of them to a specified location. How can I use the information in the file and copy all of them to a specified location? I remember achieving that but can't really remember how i did it. something like ... cp {cat list.txt} /destination/ |
Quote:
have you tried : cp -r /the directory name/ /new location/ |
I think you want something like this:
for file in `cat list`; do cp $file newplace; done "newplace" would be the target pathname Note the "backtics"---no single quotes. |
Quote:
Code:
while read file; do cp "$file" /path/to/destination/dir/; done < list |
All times are GMT -5. The time now is 11:45 AM. |