Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Howto created trimmed directory tree while using wget for ftp download

Am using wget for download files from ftp.

Ftp folder have name /var/www/html/

Inside this folder is located tree of folders & files, ~20 levels.

Am trying make ftp download (have no ssh access), of this all with wget.

wget -- recursive -nv --user user --password pass ftp://site.tld/var/www/folder/

This one command runs Ok. But it creates an folder structure.

~/back/site.tld/var/www/html/my-files-and-folders-here

Question: Is any possibility - to say wget, not create ~/site.tld/var/www/html/ but make all tree, in current folder?
i.e. ~/back/my-files-want-here/ I.e. - to trim/cut certain path?

Thanks

like image 636
publikz.com Avatar asked Jan 18 '23 06:01

publikz.com


1 Answers

Look for --no-host-directories and --cut-dirs in the manpage.

This should work like expected (maybe you have to increase/decrease cut-dirs):

wget --recursive --no-verbose --no-host-directories --cut-dirs=3 --user user --password password ftp://site.tld/var/folder
like image 185
sgibb Avatar answered Jan 29 '23 12:01

sgibb