File manipulation

pshell.concatenate(input_fnames, output_fname, mode='w', **kwargs)

Concatenate files. Python equivalent of cat input_fnames[0] input_fnames[1] ... > output_fname.

Parameters:
  • input_fnames – sequence of str. Paths to one or more input text files, to be appended one after the other to the output.
  • output_fname (str) – Path to output text file, which may or may not already exist.
  • mode (str) – Mode for opening the output file e.g. ‘w’ or ‘ab’. Defaults to text mode unless ‘b’ is explicitly declared.
  • kwargs – Passed verbatim to all the underlying pshell.open() calls. Among other things, this means that this function can transparently deal with compressed files by inspecting their extension; different files can use different compression algorithms as long as you use compression='auto' (the default).

If the output is opened in text mode, the inputs will be too; if any file does not terminate with \n, it will be added. If the output is opened in binary mode, the inputs will too; no extra bytes will be added between files.