Is there an FTP client that lets me get file names and attributes in text format?

Barfo

Lifer
Jan 4, 2005
27,539
212
106
Hello, I need to extract file names, owners, sizes and permissions of some files that I connect to through ftp and get them in excel or text format. Anyone know of a program that lets me do this without much effort?
 

TheRyuu

Diamond Member
Dec 3, 2005
5,479
14
81
Hello, I need to extract file names, owners, sizes and permissions of some files that I connect to through ftp and get them in excel or text format. Anyone know of a program that lets me do this without much effort?

If you don't mind a command line, lftp in cygwin (or just package manager -> lftp on *nix) should be able to do it. If you've never installed cygwin before I would recommend installing just all the base packages (basically just clicking next through the installer) then re-run the installer and go find lftp and install that. There's a lot of stuff available and almost all of it you don't need. I would also recommend using mintty as your terminal which I think it uses by default now so you shouldn't have to worry about that.
Code:
lftp ftp://username:password@hostname.com
You can then do all the stuff as if on a normal *nix command line: ls, cd, etc. You can download files with the 'get' command, tab auto-completion should work.

To do what you want just pipe ls to a text file, it will be written locally in the folder you ran lftp in if you don't give it a full path:
Code:
lftp username@hostname.com:~> ls > outputfile.txt
lftp caches the output of ls so if changes are made server side and you want to make sure you have the latest information you can use 'rels' to get the file list again from the server. That's really only nessasary if you know you're going to have updates or if you're spamming ls looking for changes somewhere.

The output will look something like this:
Code:
drwxr-xr-x    3 user  user      4096 May 22 23:23 folder
Full documentation can be found at the lftp site:
http://lftp.yar.ru/

It can also probably produce a text file without having to do it from within lftp itself (i.e. manually typing ls > foo.txt. I'm not sure why I said probably since it definitely sounds doable. Basically you would run the lftp command and specify the ls > file.txt all when you run lftp itself and it would do this command then exit. I might take a look at it again later and edit/post it for you when I have more time.

It will produce a regular text file with unix line endings. If you want it to be viewable in notepad you can run unix2dos outputfile.txt after exiting lftp (I believe that tool comes standard with cygwin), or just use your favorite text editor to convert it (notepad++, sublime, vim, whatever) or view it with the unix line endings with one of those. And if you really want to mess around you can also take that output and format it with other command line tools that come with cygwin (grep, sed, etc) but that sounds like going beyond what you need based on your OP :p.
 
Last edited: