1

I have launched several:

cp -r folder1 /home/USBkey/. &
cp -r folder2 /home/USBkey/. &
cp -r folder3 /home/USBkey/. &

Each folder contains mp3 files. At the end of all copies, when I listen to one mp3 in folder1 I can hear for a short time (2 or 3secs) a part of a song from folder3 for instance. Like "cp" doesn't care to other parallel "cp" and write inside another memory space it should.

Some advise about this?

Thanks

4
  • 1
    AFAIK running them in parallel is not faster than running them in sequence, especially to copy from/to a USB key. If you don't get an actual answer to your question and still have problems, try 1. copying your files from your graphical file explorer (if you have one) or 2. running the 3 cps in sequence with &&. Jun 27, 2017 at 12:55
  • As @NathanShiraini says, you need to copy in sequence, though it is probably better not to use &&, which will stop subsequent copies if there is an error in an earlier copy.
    – AFH
    Jun 27, 2017 at 13:11
  • @NathanShiraini: it is not only an issue of how it is fast but also that cp in parallel seems to mix the audio files... very weird. How to perform subsequent copy without && and in one line?
    – FTG
    Jun 27, 2017 at 13:36
  • @FTG I know, but I do not know what are the gurratees of cpregarding parallel execution, so I didn't mention it. As for sequential execution of multiple commands, you can use ; as the separator to run each command regardless of the result of the last one. E.G.: cp -r folder1 /home/USBkey/. ; cp -r folder2 /home/USBkey/. ; cp -r folder3 /home/USBkey/. Jun 27, 2017 at 13:43

1 Answer 1

1

You can copy the folders content as:

cp -r folder1/ folder2/ folder3/ /home/USBkey/.

If you want to have the folders inside the /home/USBkey/ directory only remvoe the / as:

cp -r folder1 folder2 folder3 /home/USBkey/.

This still being a copy in sequence.

1
  • +1 for the single command form, unlike in my comments! By the way, when typing code, remember to surround it in `` backticks or indent it with four spaces. Jun 27, 2017 at 17:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .