Skip to main content

nextflow fs

Perform basic filesystem operations.

Usage

$ nextflow fs <subcommand> [args]

Description

The fs command performs filesystem operations such as copy, move, delete, and list directory. Like the file() method, it works with local files, remote URLs, and remote object storage. Provide storage credentials the same way you provide them when launching a pipeline, through Nextflow config or environment variables.

The source path of each subcommand can be a glob pattern. The subcommand then applies to every matching file.

Options

-h, -help

Print the command usage.

Subcommands

cat <path>

Print the contents of a file to standard output.

cp <source> <target>

Copy a file or directory.

ls <path>

List the contents of a directory.

mv <source> <target>

Move a file or directory.

rm <path>

Delete a file or directory.

stat <path>
Added in version 23.10

Print the attributes of a file or directory: name, size, whether it is a directory, last modified time, and creation time.

Examples

List the contents of a remote directory:

$ nextflow fs ls 's3://my-bucket/data/*'

Print the contents of a remote file:

$ nextflow fs cat s3://my-bucket/data/file.txt

Copy a file to another bucket:

$ nextflow fs cp s3://my-bucket/data/file.txt s3://dest/

Copy every file matching a glob pattern:

$ nextflow fs cp 's3://my-bucket/data/*.txt' s3://dest/

Move a file:

$ nextflow fs mv s3://my-bucket/data/file.txt s3://my-bucket/archive/file.txt

Delete a file:

$ nextflow fs rm s3://my-bucket/archive/file.txt

Print the attributes of a file:

$ nextflow fs stat s3://my-bucket/data/file.txt