4

lftp can get the files which symbolic links point to, but can it get these files if they are in directories represented by symbolic links? For example, I am looking to get files at

ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/bacteria/Acinetobacter_nosocomialis/all_assembly_versions/GCA_000162375.2_Acin_sp_RUH2624_V1/

where /GCA_000162375.2_Acin_sp_RUH2624_V1/ is a symbolic link to a directory.

I tried adding set ftp:list-options "-La" to ~/.lftprc, ~.lftp/rc, and /etc/lftp.conf.

This is the command I am using:

lftp -c 'open -e "mirror -c -p --no-empty-dirs -I *.gz /genomes/genbank/bacteria/Acinetobacter_nosocomialis/ ~/ncbi_bacteria_mirror" ftp.ncbi.nlm.nih.gov'

This command DOES work on ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/bacteria/Pseudomonas_sp._URMO17WK12_I11/all_assembly_versions/

where /all_assembly_versions/ is not a symbolic link. It does not however recursively follow the symbolically linked directories contained within and get the files from those directories, which I would like for it to do if possible.

truthling
  • 134
  • 10
  • Just a note that for THIS particular site, replacing ftp with https will work as one might expect (following symlinks). – seandavi Nov 29 '17 at 01:20

2 Answers2

2

Resolving the file name to the file on disk and thereby resolving symbolic links is done at the server. Thus there is no need for the ftp client to resolve these links, which means it will not even attempt it by trying to guess the format of the directory listing.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
0

I am not sure I understand the question, and the answer is hidden in it: the -L flag is what you want.

Quoting lftp's man page:

-L, --dereference download symbolic links as files

That's really it!

Clément
  • 2,358
  • 28
  • 32