Sign in to follow this  
BlueShizz

FTP ls command with URL

Recommended Posts

I'm trying to get the list of all the files in an ftp server through Java, so I get the text file of the root directory and it gives me stuff like this: drwx------ 2 32013 username 4096 Apr 10 15:09 .trash I am in need of 1 of 2 things: How would I parse this text (like explode it into an array) to get the directory, or How would I process the ls command?

Share this post


Link to post
Share on other sites
Slightly off topic: One of the annoying things about FTP is there's no specification on how directory listings should be sent. So the exact format of the lines could be different for different servers.

It's been ages since I used Java, but can't you just split the line up based on spaces, and then determine what part you're looking at?

Share this post


Link to post
Share on other sites
I considered that, but the problem is that there are a different number of spaces in between each file listing.

Is there a function that will turn multiple spaces next to eachother into a single space?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this