Paths

Certain operations work on paths. Couchdrop has a bunch of path variables available that can be used to craft relevant paths.

When working with paths, we need to determine whether the path provided is a folder or absolute filename.

If the path provided ends with a "/", then we will assume that the path is a directory and include it and the original filename,

For example:

Source FileConfigured PathResult

/directory/filename.txt

/newdir/

/newdir/filename.txt

/directory/filename.txt

filename2.txt

/directory/filename2.txt

You can use dynamic variables in the path to compose a useful destination filename. Available variables are:

VariableExample ResultDesc

{EXISTING_NAME}

filename.txt

Take the filename

{TIMESTAMP}

160331234

A unix timestamp

{YYYY}

2050

The current year

{YY}

50

The current year in shorthand

{MM}

03

The month

{DD}

10

The day of the month

{USER}

donald

The user on the event

{EVENT.*}

{EVENT.username} - donald

Any attribute on the event

An example of a dynamic path used in a copy operation:

{
    "type":"copy",
    "copy_to":"/processed_files/{USER}/{YY}/{MM}/{DD}/{EXISTING_FILENAME}"
}

Last updated