Wget for ftp using a password containing @

ftpwget

I am trying to get some files from my ftp server from the command line. I am using wget to download the whole folder at once. The command is:

wget -m ftp://username:password@ftp.hostname.com:/path/to/folder

But the problem is, my password contains the '@' symbol. Hence The command becomes

wget -m ftp://username:foo@bar@ftp.hostname.com:/.. 

due to which, wget tries to resove bar@ftp.hostname.com as the host, which it is not able to. Please help!

Best Answer

Rather than the user:pass@hostname syntax, use switches. From wget --help:

--ftp-user=USER         set ftp user to USER.
--ftp-password=PASS     set ftp password to PASS.

Example:

wget -m --ftp-user=username --ftp-password=foo@bar ftp://ftp.hostname.com/file
Related Question