Home > HOWTOs > FTP using wget

FTP using wget

Below is a small script snippet to collect data from FTP server using wget.


# Getting data from FTP server now.
wget --ftp-user='username' --ftp-password='passwd' --no-passive-ftp ftp://ftpserver//FileName.zip -P $FTP_DOWNLOAD_BASE_PATH/ - q

# Sample Code below to do some ftp collection
currentdate=$1
loopenddate=$2

if [ "$currentdate" -lt "$loopenddate" ]
then
until [ "$currentdate" -eq "$loopenddate" ]
do
echo "$currentdate:Started wget"
wget --ftp-user=username --ftp-password='passwd' -m --no-passive-ftp ftp://ftpserver//$currentdate/ -P /ftp/$currentdate - q
echo "$d:Finished wget"
currentdate=$(/bin/date --date "$currentdate 1 day" +%Y%m%d)
done
fi

Complete FTP using wget will be on git. Will update soon.

Advertisements
Categories: HOWTOs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: