linux - "xargs -a file" to copy files to a folder -
i tring use xargs -a
read contents of file has list of filenames in it.
my directory working in looks like:
backups file1.bak file2.bak file3.bak bakfiles.txt
file name filenames in it: bakfiles.txt
bakfiles.txt contents:
file1.bak file2.bak file3.bak
so i'm trying copy file1.bak,file2.bak,file3.bak
folder backups
. using contents of bakfiles.txt
so.
i tried:
xargs -a bakfiles.txt | cp {} backups
but error:
cp: cannot stat `{}': no such file or directory
i should mention tried:
xargs -a bakfiles.txt cp {} backups
and error:
cp: target `file3.bak' not directory
this works me on windows 7 using mks toolkit version of 'xargs'
cat bakfiles.txt | xargs -i '{}' cp '{}' backups/'{}'
Comments
Post a Comment