Unfortunately, I don't believe there's a built-in Wolfram Language function that can list the contents of a remote directory. But if you have a Unix-based machine, (Linux, BSD, Mac, etc.) you can use this function I wrote:
ftpFileNames[host_, path_: "/", type_: All] := Block[{matrix},
matrix =
StringSplit[
StringSplit[RunProcess[{"ftp", "-n"}, "StandardOutput",
"open " <> host "
user anonymous anonymous
ls " <> path <> "
bye"], "\n"], " " ..];
Select[matrix,
StringMatchQ[StringTake[#[[1]], 1],
Switch[type, All, "d" | "-", "File", "-", "Directory",
"d"]] &][[All, -1]]
]
In[1]:= ftpFileNames["ftp.ncbi.nih.gov","/"]
Out[1]= {"1000genomes", "100GB", "10GB", "1GB", "50GB", "5GB", "README.ftp",
"bigwig", "bioproject", "biosample", "blast", "cgap", "clemson",
"cn3d", "dbgap", "entrez", "epigenomics", "eqtl", "fa2htgs",
"favicon.ico", "genbank", "gene", "genomes", "geo", "giab", "hapmap",
"mmdb", "ncbi-asn1", "pathogen", "pub", "pubchem", "pubmed",
"refseq", "repository", "robots.txt", "sequin", "sky-cgh", "snp",
"sra", "tech-reports", "toolbox", "tpa", "variation"}
By default it lists both files and directories, but you can pass "File"
or "Directory"
as a third argument to limit the results. I hope this helps!