MultiCopy: copy a file to multiple destinations

Often i have to copy manually a single file into many destination directories (or files), so i decided to create a command line tool to do help me in doing this task: Multicopy (mcp).

The program can be used as show below:

  • mcp <src_file> <directory_1> <directory_2> … <directory_n>
    copy file <src_file> into the given directories
  • mcp <src_file> <file_1> <file_2> … <file_n>
    copy file <src_file> into given files (creating/overwriting them)
  • mcp -b <byte_buffer> <src_file> <directory_1> <directory_2> … <directory_n>
    copy file <src_file> into given directories using a buffer of <byte_buffer> bytes
  • mcp -b <byte_buffer> <src_file>¬† <file_1> <file_2> … <file_n>
    copy file <src_file> into given files (creating/overwriting them) using a buffer of <byte_buffer> bytes

If you have files/direcotry named as a parameter accepted by mcp you could use — (a couple of – character) to tell the program that every string that follows is not a parameter it has to parse but simple file names and/or directory names.

Usage Examples:

  • copy file /tmp/test.txt into directory /home/davide/ and into file /usr/local/copia.txt
  • copy file /tmp/test.txt into /tmp/uno.txt and /tmp/due.txt, reading/writing blocks of 4096 bytes
  • copy file¬† -b into /tmp/prova and /tmp/prova2

The source code is available on GitHub at this url, you will find also a couple of precompiled binaries (one built on Slackware64 for x86-64 and another one built on Raspbian for RaspberryPi 3).

Leave a comment