Get directory/file structure without payload from FTP server

0

I need to recursively retrieve the file/directory structure of an FTP server, getting only file names (without payload). Can you help me how to do this? (curl, wget, …).

The result should be the directory tree with all files with 0 size, but also a text file with file/dir list can be good.

I tried to use the .listing generated by wget but it's too much verbose (I need only file name with full path).

Nick El Cadmio

Posted 2013-02-20T16:57:21.870

Reputation: 1

Better gives sample inputs/outputs – Gilles Quenot – 2013-02-20T17:06:27.133

Answers

0

If curlftpfs is available for you, use it (see this another answer of mine). You will be able to browse the remote directory tree as if it was local.

Tools like cp will work, so if you really need a local copy of the directory tree without the payload, use this command:

cp -R --attributes-only /curlftpfs/mountpoint/ /some/local/path/

(Note: --attributes-only is not required by POSIX, your cp may or may not understand it).

Kamil Maciorowski

Posted 2013-02-20T16:57:21.870

Reputation: 38 429

0

A basic aproach :

lftp -u user,passwd domain.tld -e 'nlist *; quit' | awk '$5 == 0'

Gilles Quenot

Posted 2013-02-20T16:57:21.870

Reputation: 3 111