4

I'd been seeing that * isn't interpreted on ftp or lftp. Suppose I want to change a directory from current to say ./japan

In ftp> of lftp>, if I give:

$ cd jap*

it would show this error:

No such file or directory

So, I'm forced to give the complete name:

$ cd japan

EDIT #1

@thomas, @gold: Thank you for your valuable information. As * isn't interpreted with all commands (like cd), is there any way so that I can get away from typing every time the complete file name.

  • You forgot something. – Ignacio Vazquez-Abrams Oct 7 '13 at 13:09
  • What are you asking? I don't see a question being asked here... – John Oct 7 '13 at 13:16
  • 2
    It sounds like you are confusing shell file expansion with ftp client features. lftp supports wildcard expansion with the mput, mget and mrm commands. – Thomas Nyman Oct 7 '13 at 13:17
  • To elaborate: the cd command in ftp is similar to the shell's cd, but they are not the same, and ftp is not a sh. – goldilocks Oct 7 '13 at 13:45
  • Do you mean get away without typing the complete file name? – kurtm Oct 7 '13 at 15:10
4

If you're using lftp you can use the Tab key to do path completion similar to the same method used when in a shell such as Bash or Zsh.

If you continue to hit Tab as you type it will complete as much of what matches. You can continue to type additional characters from the results of what's left that matches what you're typed thus far.

Example

Initially after connecting to an SFTP server.

lftp me@sftpserver:~> pwd
sftp://me@sftpserver/home/me

It I type cd u and then hit Tab one time it will complete this:

lftp me@sftpserver:~> cd upload/

If I hit it a 2nd time:

lftp me@sftpserver:~> cd upload/
2011-07-12/  a/

If I type a 2 and hit Tab another time it will complete like this:

lftp me@sftpserver:~> cd upload/2011-07-12/

At which point if you hit Enter it will run the above cd command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.