Run

This command is useful to issue commands in the directory of your library.

Examples

  • List all files in the library directory

    papis run ls
    
  • Find a file the library directory using the find command

    papis run find -name 'document.pdf'
    
  • Find all PDFs in the document folders matching “einstein”

    papis run -p einstein --all -- find . -name '*.pdf'
    

    In general, the symbol -- is advisable so that the arguments after it are considered as positional arguments for the shell commands.

    In this example you could also use pipes. For instance, to print the absolute path to the files, in Linux you can use the command readlink -f and a pipe | to do this, i.e.

    papis run -p einstein \
            --all -- "find . -name '*.pdf' | xargs readlink -f"
    
  • Replace some text in all info.yaml files by something. For instance imagine you want to replace all note field names in the info.yaml files by _note so that the note field does not get exported. You can do

    papis run -a -- sed -i 's/^note:/_note:/' info.yaml
    

Command-line Interface

Run an arbitrary shell command in the library or command folder

papis run [OPTIONS] <COMMANDS>

Options

-h, --help

Show this message and exit.

-p, --pick <QUERY>

Give a query to pick a document to run the command in its folder

--sort <FIELD>

Sort documents with respect to the FIELD

--reverse

Reverse sort order

--doc-folder <doc_folder>

Document folder on which to apply action

-a, --all

Apply action to all matching documents

--prefix <PREFIX>

Prefix shell commands by a prefix command

Arguments

<COMMANDS>

Optional argument(s)