Listing all files on FTP Server

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Listing all files on FTP Server
# 1  
Old 11-21-2007
Listing all files on FTP Server


I am the definition of UNIX newbie so please bare with me. I am wondering the best way to list all files on a ftp server.

If I use

curl -l ftp://user:password@ftp_server

This shows me the root of the ftp server, but I would like to get a listing of everything in the subfolders

Any help would be greatly appreciated.
# 2  
Old 11-22-2007
Looking at my version of curl, recursive options is not introduced as feature, I guess you want to do something like "ls -lR", but I don't see that option.
# 3  
Old 11-22-2007
That is exactly what I want to do, but I have no idea if there is anyway to do it. Like you say I can't find an argument in curl for this. I don't have to use curl. I think I could do it with a bash script for the FTP program. Catch is that I don't know how to write a bash script to do this.
# 4  
Old 11-22-2007
how 'bout wget
# 5  
Old 11-22-2007
I am hoping to do it without installing any additional software so I can run it as part of a larger application that can run on any OSX computer.

I found this through a web search but it gives me an error message.

I made a script with the following lines in it;

open <- IP address for FTP Server
user myusername mypassword
ls -R

then it is run from the command line with this command

ftp -inv /location/of/script &

but I get an error message that says

No address associated with nodename

If i type in these same commands through the FTP interface it works fine.

Does anyone know what the problem might be?
Thanks for your help
# 6  
Old 11-22-2007
I have a way to do it now, Thanks for the replies everyone.

I used the following bash script to get it to work.

ftp $hostname << EOF
ls -1R

# 7  
Old 11-22-2007

Thanks for posting your solution. That's a useful script to have.

If you want to add username/password and dump the list to a local file, you might consider this:

ftp -i -nv $hostname << EOF
user username password
lcd /path/to/local/dir
ls -1R ftpList.txt

Of course, since this has the username/password you need to have absolute control over this script. I use something similar to this for internal purposes at work. Also, remember it's possible to configure some ftp servers so that "ls -R" is disabled (like vsftpd).


Last edited by cassj; 11-22-2007 at 06:11 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

FTP-ing files from Windows server to UNIX server

I need to transfer files from a Windows server to the Unix server and have to run some shell script on it to get the required output. Is it possible to transfer files from Windows server to unix server through any shell script? If so can you please help me with the details. Thanks in... (8 Replies)
Discussion started by: ssk250
8 Replies

2. Shell Programming and Scripting

Listing Files and Sizes on FTP server

Need assistance in getting File size for the List of files using perl script . I have writtern 2 codes. One of them gives me the list of files and 2nd one give me the size for only 1 file. I dont know how to club both of them to get the list of files with its size . #!/usr/bin/perl -w... (11 Replies)
Discussion started by: ajayram_arya
11 Replies

3. Shell Programming and Scripting

FTP multiple files from one server to one server

Hi, I'm new to shell script..I have one requriement like - In one server have more than one files,I want to ftp those files to some otehr server.. Ex : test1.pdf test2.pdf Please suggest me how to do (3 Replies)
Discussion started by: venkaswa
3 Replies

4. Shell Programming and Scripting

Need help creating a script to FTP files to a server and then delete the files that were transfered.

I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies

5. Shell Programming and Scripting

script for to take files from FTP server to UNIX server and Unzipped that files

script for to take files from FTP server to UNIX server and Unzipped that files (1 Reply)
Discussion started by: sunilamarnadh
1 Replies

6. UNIX for Dummies Questions & Answers

Long listing of files using find command on remote server via SSH

Hi , I am trying to find some files on a remote machine using the find command. >ssh -q atukuri@remotehostname find /home/atukuri/ -name abc.txt /home/atukuri/abc.txt The above command works fine and lists the file, but if I want to do a long listing of files (ls -l) its not working . ... (2 Replies)
Discussion started by: atukuri
2 Replies

7. Filesystems, Disks and Memory

Not able to FTP the files to a FTP server

Hi , We are facing a weird problem in our project. we need to send some xml & audio files to a remote FTP server from a Linux box, we are doing this in Perl script using Net::FTP->. Issue here is.. when FTPed the files using Perl scripts, only empty files ( 0 byte) are getting created on the... (2 Replies)
Discussion started by: kishorepotta
2 Replies

8. AIX

listing files on remote server

I am writing a script where in i have to log into a remote machine and check for necessary file by typing (ls -ltr *200505) (this gets all 05month of 2008 yr files) and if files are found get them to the local machine. If not found print a message saying no files on local machine. When i was... (3 Replies)
Discussion started by: vasuarjula
3 Replies

9. Shell Programming and Scripting

FTP multiple files from remote server to local server

Hi, I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Discussion started by: berlin_germany
2 Replies

10. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies
Login or Register to Ask a Question