Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Bash copy help

Name: Anonymous 2009-04-20 4:39

I have a file of paths, separated with newlines, and I want to copy every file in that list to a specified location, how do I do that?

Name: Anonymous 2009-04-20 4:58

Select the files, then drag them to the destination directory while keeping shift pressed.

Name: Anonymous 2009-04-20 5:08

xargs

Name: Anonymous 2009-04-20 5:11

>>2
Thats not bash.

Name: Anonymous 2009-04-20 5:22

>>3
you HELPED ME, thank you.

Name: Anonymous 2009-04-20 8:53

Any time you're using xargs I would strongly suggest using -0 to avoid surprises. For example if you have a file with ' in the name it'll screw things up.

That is, instead of:
xargs whatever < file
use:
tr \\n \\0 < file | xargs -0 whatever
and your xargs will behave itself.

Name: Anonymous 2009-04-20 11:22

>>6
More like xargs -d\\n -afile -- cp -t somewhere.

Name: Anonymous 2009-04-20 12:37

>>7
Filenames can contain newlines. (I have even encountered such files, in fact.)

Name: Anonymous 2009-04-20 12:43

(P.S. -d is nonstandard and only works on GNUshit. Same for that retarded -t option to cp.)

Name: Anonymous 2009-04-20 13:07

>>8-9
>>1 clearly states that the filenames are seperated with newlines. The damage has already been done, so the useless use of tr in >>6 doesn't help.

(P.S. xargs -0 is nonstandard too.)

Name: Anonymous 2009-04-20 14:20

>>10
-0 works on BSD. -d and -t do not.

Don't change these.
Name: Email:
Entire Thread Thread List