Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As far as I remeber, long time ago I've been using such a thing: in total commander I pressed F2 in copy dialoge - added "copy task" into a "Copy queue". And so, all those files have been copied sequentially. Is there any simple tool for such a "sequential" coping?

Edit: I'd want to add "copy tasks" to the queue dynamicly.

Example: I have lots of heavy files. I understand what I want to copy file A. While file A is coping, I understand that I also must copy file B to somewhere, but I need to start coping it right after A is already copied.

share|improve this question
1  
What queue? Why don't you just use cp? – terdon Jan 22 '13 at 15:11
    
So, what you are trying to avoid is copying more than one file at the same time? – terdon Jan 22 '13 at 15:16
    
Yes, exactly. And an ability to change this sequence dynamicly. I apologize for being unable to express what I want today enving. – MInner Jan 22 '13 at 15:20
    
To do two tasks after each other use ;, && or ||. E,g 'task1 ; task2' will run task1, and then task2. Both tasks could by copy commands. ( && and || are conditionals. task1 && task2 means run task1, if succesful (no error condition) then run task2, else skip task2. || or the reverse, run only on error. ) – Hennes Jan 22 '13 at 15:23
1  
Do you need a terminal solution or is a Total Commander clone enough for you? "krusader" from KDE contains the copy queue feature as well. – Tim Jan 22 '13 at 15:45

I'm not sure what you mean, that is the default behavior of the copy command (cp):

  • Copy many files:

    cp *txt *jpg destination_dir
    

Here are some examples of more complex operations:

  1. Copy all files read from a list (assuming sane file names, no spaces or weird characters):

    while read n; do cp $n destination_dir < file_list.txt
    
  2. As above but works for file names with spaces or strange characters:

    while IFS= read -r n; do cp "$n" destination_dir < file_list.txt
    
  3. Find all files matching a pattern and copy them:

    find . -name "*data*" -exec cp {} destination_dir \;
    
  4. As above but works with weird file names:

    find . -print0 -name "*data*" | xargs -0 cp -t destination_dir \;
    

I still don't understand why you would want to do this but OK. To add a copy operation to be executed after the current one has ended, you could do this:

  1. Create a list of the files you want to copy. Since you start with one file, the list will contain just one file name:

    echo "fileA" > list.txt
    
  2. Start copying the file by reading the list (as before, this assumes sane file names, use example 2 from the list above if your file name can contain spaces or strange, non alphanumeric characters):

    while read n; do cp -v $n destination_dir < file_list.txt
    
  3. Find the next file you want to copy and add it to the list:

    echo "fileB" >> list.txt
    

As long as you do step 3 before the copying has finished, the next file will be copied as soon as the first one is done.

I just don't understand why you don't simply launch many independent cp commands instead. You are complicating things with no reason as far as I can tell.

share|improve this answer
    
I know, thank you. I'd want to add "copy tasks" to the queue dynamicly. – MInner Jan 22 '13 at 15:11
    
You mean you need a solution for total commander? – terdon Jan 22 '13 at 15:12
    
I need something, that works under unix just like "TC copy queue" did under windows. – MInner Jan 22 '13 at 15:16
    
I figured that out but I have never used "TC copy queue". Could you please explain why you need to start copying fileB only after fileA has finished? Otherwise you can just launch N cp commands in parallel. – terdon Jan 22 '13 at 15:19

You must log in to answer this question.

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