Skip to content

Instantly share code, notes, and snippets.

@rafamdr
Created November 16, 2020 11:47
Show Gist options
  • Save rafamdr/ad7868175e01a30a3832d0fd31fa35cb to your computer and use it in GitHub Desktop.
Save rafamdr/ad7868175e01a30a3832d0fd31fa35cb to your computer and use it in GitHub Desktop.
How to recursively download a folder via FTP on Linux
wget -r -nH --cut-dirs=5 -nc ftp://user:pass@server//absolute/path/to/directory
# -nH avoids the creation of a directory named after the server name
# -nc avoids creating a new file if it already exists on the destination (it is just skipped)
# --cut-dirs=5 allows to take the content of /absolute/path/to/directory and to put it in the directory where you launch wget. The number 5 is used to filter out the 5 components of the path. The double slash means an extra component.
# Source: https://stackoverflow.com/questions/113886/how-to-recursively-download-a-folder-via-ftp-on-linux#answer-5567776:~:text=Just%20to%20complement%20the%20answer%20given%20by%20Thibaut%20Barr%C3%A8re.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment