1

Is there a way to download all files from a ftp link, preferably not overwriting if same file already exists in download folder? I can download specific links like this:

import urllib 

urllib.urlretrieve('ftp://server/path/to/file', 'file')
martineau
  • 119,623
  • 25
  • 170
  • 301
user308827
  • 21,227
  • 87
  • 254
  • 417
  • 1
    What do you mean, "links"? FTP doesn't have links. – Daniel Roseman Jun 24 '17 at 13:56
  • If you are trying to connect to an FTP server, maybe you should also use something that is more FTP-friendly in Python? There *is* [ftplib](https://docs.python.org/3/library/ftplib.html) available to you out-of-the-box. – idjaw Jun 24 '17 at 13:59
  • thanks @DanielRoseman, I mean all files on a ftp page. – user308827 Jun 24 '17 at 14:03
  • @idjaw, I am open to FTPlib, but does it allow to download all files on the server? – user308827 Jun 24 '17 at 14:03
  • You can use `wget` from the command-line to fetch via ftp if python is not a requirement for the task. Note that ftp does not support the `*` and you must use a flag to `wget`. – Niklas Rosencrantz Jun 24 '17 at 14:03
  • @user308827 Have you read the documentation and played around with it to see if it would help you? I suggest you dive in and play around. Think of it like a nice big sandbox. :) – idjaw Jun 24 '17 at 14:03
  • thanks @idjaw, that is a fair comment. I do have a working prototype to get one file from the ftp server at a time – user308827 Jun 24 '17 at 14:04
  • There's nothing like "ftp page". Maybe you mean all files in a directory on FTP server? – Martin Prikryl Jun 25 '17 at 18:44

0 Answers0