Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
184 lines (109 sloc) 5.35 KB

Module trooper_scp

Trooper SCP is in charge of handle remote/local files copy.

Description

You need to have a tropper SSH connection opened to list remote files, upload local files to the remote place or download remote files.

Data Types

file_handler()

abstract datatype: file_handler()

reason()


reason() = atom()

Function Index

close/1Closes the handler.
del_dir/2Removes a remote directory.
delete/2Deletes a remote file.
list_dir/2List remote directory.
make_dir/2Creates a remote directory.
make_symlink/3Makes a symlink in the a remote server.
open/3Opens a remote file using a handler to let use read and write.
read/2Reads information from an opened remote file.
read_file/2Reads a remote file content.
rename/3Renames a remote file.
write/2Writes information to an opened remote file.
write_file/3Writes a remote file content.

Function Details

close/1


close(File_handler::file_handler()) -> ok | {error, reason()}

Closes the handler.

del_dir/2


del_dir(Trooper::trooper_ssh:trooper(), Name::string()) -> ok | {error, reason()}

Removes a remote directory.

delete/2


delete(Trooper::trooper_ssh:trooper(), Name::string()) -> ok | {error, reason()}

Deletes a remote file.

list_dir/2


list_dir(Trooper::trooper_ssh:trooper(), Path::string()) -> {ok, [string()]} | {error, reason()}

List remote directory.

make_dir/2


make_dir(Trooper::trooper_ssh:trooper(), Name::string()) -> ok | {error, reason()}

Creates a remote directory.

make_symlink/3


make_symlink(Trooper::trooper_ssh:trooper(), Name::string(), Target::string()) -> ok | {error, reason()}

Makes a symlink in the a remote server.

open/3


open(File_handler::file_handler(), Name::string(), Mode::ssh_sftp:mode()) -> {ok, file_handler()} | {error, reason()}

Opens a remote file using a handler to let use read and write. Depending on the mode in use.

read/2


read(File_handler::file_handler(), Len::pos_integer()) -> {ok, binary()} | eof | {ok, reason()}

Reads information from an opened remote file.

read_file/2


read_file(Trooper::trooper_ssh:trooper(), Name::string()) -> {ok, binary()} | {error, reason()}

Reads a remote file content.

rename/3


rename(Trooper::trooper_ssh:trooper(), OldName::string(), NewName::string()) -> ok | {error, reason()}

Renames a remote file.

write/2


write(File_handler::file_handler(), Data::iolist()) -> ok | {error, reason()}

Writes information to an opened remote file.

write_file/3


write_file(Trooper::trooper_ssh:trooper(), Name::string(), Content::iolist()) -> ok | {error, reason()}

Writes a remote file content.

You can’t perform that action at this time.