NAME

CTK::Plugin::SFTP - SFTP plugin

VERSION

Version 1.01

SYNOPSIS

use CTK;
my $ctk = new CTK(
        plugins => "sftp",
    );

$ctk->fetch_sftp(
    -url     => 'sftp://anonymous@192.168.0.1/Public/test?timeout=30',
    -op      => "copy", # copy / move
    -uniq    => 1, # 0 -- off; 1 -- on
    -dirdst  => "/path/to/destination/dir", # Destination directory
    -filter  => qr/\.tmp$/,
);

$ctk->store_sftp(
    -url     => 'sftp://anonymous@192.168.0.1/Public/test?timeout=30',
    -op      => "copy", # copy / move
    -uniq    => 1, # 0 -- off; 1 -- on
    -dirsrc  => "/path/to/source/dir", # Source directory
    -filter  => qr/\.tmp$/,
)

DESCRIPTION

SFTP plugin

NOTE! For initialization SSH connection please run follow commands first:

ssh-keygen -t rsa
ssh-copy-id -i /path/to/private/file.pub user@example.com

METHODS

fetch_sftp

$ctk->fetch_sftp(
    -url     => 'sftp://anonymous@192.168.0.1/Public/test?timeout=30',
    -op      => "copy", # copy / move
    -uniq    => 1, # 0 -- off; 1 -- on
    -dirdst  => "/path/to/destination/dir", # Destination directory
    -files   => ['foo.tgz', 'bar.tgz', 'baz.tgz'],
);

Download specified files from resource

$ctk->fetch_sftp(
    -url     => 'sftp://anonymous@192.168.0.1/Public/test?timeout=30',
    -op      => "copy", # copy / move
    -uniq    => 1, # 0 -- off; 1 -- on
    -dirdst  => "/path/to/destination/dir", # Destination directory
    -filter  => qr/\.tmp$/,
);

Download files from remote resource by regexp mask

-url

URL of resource.

For example:

sftp://anonymous@192.168.0.1/Public/test?timeout=30

timeout=30 -- SFTP atrtributes. See Net::SFTP::Foreign

-dirout, -out, -dirdst, -dst, -target

Specifies destination directory

Default: current directory

-filter, -list, -mask, -files, -regexp
-list => [qw/ file1.txt file2.txt /]

List of files

-file => "file1.txt"

Name of file

-regexp => qr/\.(cgi|pl)$/i

Regexp

Default: undef (all files)

-op, -cmd, -command

Operation name. Allowed: copy, move

Default: copy

-uniq, -unique

Unique mode

Default: off

store_sftp

$ctk->store_sftp(
    -url     => 'sftp://anonymous@192.168.0.1/Public/test?timeout=30',
    -op      => "copy", # copy / move
    -uniq    => 1, # 0 -- off; 1 -- on
    -dirsrc  => "/path/to/source/dir", # Source directory
    -filter  => qr/\.tmp$/,
)

Upload files from local directory to remote resource by regexp mask

-url

URL of resource.

For example:

sftp://anonymous@192.168.0.1/Public/test?timeout=30

timeout=30 -- SFTP atrtributes. See Net::SFTP::Foreign

-dirin, -in, -dirsrc, -src, -source

Specifies source directory

Default: current directory

-filter, -list, -mask, -files, -regexp, -glob
-list => [qw/ file1.zip file2.zip /]

List of files

-file => "file1.zip"

Name of file

-glob => "*.zip"

Glob pattern

-regexp => qr/\.(zip|zip2)$/i

Regexp

Default: undef (all files)

-op, -cmd, -command

Operation name. Allowed: copy, move

Default: copy

-uniq, -unique

Unique mode

Default: off

DEPENDENCIES

CTK, CTK::Plugin, Net::SFTP::Foreign

HISTORY

See Changes file

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

CTK, CTK::Plugin, Net::SFTP::Foreign

AUTHOR

Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2020 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/