Accessing Swestore with lftp
Status
Current lftp version as shipped in most Linux distributions are having issues in presenting a directory listing that makes sense to users, among the issues is a tendency to mix files from the root directory and the current directory.
As such, we recommend that lftp is not used for file transfers from/to Swestore.
Introduction
lftp is an interactive text-mode file transfer tool that understands multiple access protocols. It is commonly available in Linux/Unix environments.
The benefit over tools like cURL is that it has interactive traversal of the directory hierarchy, as well as powerful mass-transfer functionality like the mirror
command, mput/mget
and more. Use help
in lftp for details. This is not intended to be a complete lftp usage howto, refer to tutorials online for this.
This guide explains how to use lftp with username/password authentication.
Authenticate using username/password
- Prerequisite: Username and password, see Setting your Swestore password
- Open a terminal window
- Start lftp with:
lftp -u username https://webdav.swestore.se/
- Enter your password at the prompt
- NOTE: Password will be verified on first command/connection, so typing the wrong password will error out later!
Usage
There are some quirks that lftp has together with the Swestore WebDAV door.
When giving a directory path to a command, it should end with a trailing slash to indicate that it is a directory. If this is omitted, the client will get a redirection response that the tool doesn't handle properly.
All the commands mentioned in this section and the previous configuration section are commands inside of a running lftp
program.
Some sample tasks that can be achieved with lftp is retrieving or uploading single files or whole directory trees.
Navigate around with the use of the cd
command:
cd snic/project_name_here/
Note the trailing / !
Individual files can be manipulated using the get
and put
commands, while mget
and mput
transfers multiple files at once. The mirror
command can transfer whole trees.
The program has interactive help for any command through the help
command.
For mirroring the flag -R is particularly relevant as -R controls the direction of the operation - if it is present the transfer is mirroring to the server, otherwise it's mirroring from the server.
For example, the command
mirror A B
will download all of the remote directory A into the local directory named B.
The command
mirror -R C D
will upload all of the local directory C into the remote directory named D. Note that the role of the directories is reversed compared to the previous example.
Credits
This guide was initially written by Lars Viklund and subsequently revised by Niklas Edmundsson.