Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of files from FTP server

Tags:

bash

ftp

I'm trying to get a list of all the files we have on a server ( specifically every pdf file we have there ). I've tried using total commander and search for the files. It worked to some extent, as in, i got a list of every pdf we had there, but no way of exporting the results ( we have 100.000+ files there )

I've tried using a bash script to get the information, but i'm not very experienced with linux, and i don't really know what i'm doing.

My script looks like this :

#!/bin/bash
hostname="<host>"
ftp -i -nv $hostname << EOF
user <username> <password>
ls -R 
EOF

Running the above script i get

?Invalid command
501 Illegal PORT command
ftp: bind: Address already in use
221 Goodbye

Any help or pointing me on what to search would be greatly appreciated.

like image 200
Raz Avatar asked Mar 29 '13 15:03

Raz


1 Answers

With curl, this is handy
curl ftp://yourftpserver/dir/ --user username:password

like image 121
user1587276 Avatar answered Oct 08 '22 20:10

user1587276