Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FTP command to List only directories. Impossible?

Tags:

linux

ftp

How do I perform directory listing but only display directories?

I tried ls | grep '/' but it got rejected with the error : usage: ls remote-directory local-file

This is because command line in FTP is different than your usual linux command line, but I was wondering if there is something equivalent in FTP command

Thanks in advance

like image 509
Roy Avatar asked Mar 02 '12 07:03

Roy


1 Answers

The FTP protocol does not directly support such a feature. It does, however, allow for a broad interpretation that some servers use to accept things like using ls-style arguments (e.g. LIST -d, as mentioned by bdk).

Without such a broad interpretation by the server, you are left with retrieving this information from the listing. Unfortunately the standard doesn't provide a fixed format for this either (although it seems most servers use the ls -l formatting).

like image 167
mweerden Avatar answered Oct 13 '22 07:10

mweerden