[Note] #Synchronizing Remote FTP folder to Local Drive #Linux #FTP #Sync

Linux Oct 06, 2020

Sometimes you need to watch a FTP directory for new files and periodically downloading the. Even if you can create a script to use ftp command and trigger it through crontab - I also suggest to use LFTP or NCFTP , though it is not a regular command. LFTP having a bunch of functions and it is really advance. NCFTP is more simplistic.


To watch a directory and download new files in 30 seconds interval, use following command

lftp -c "set ssl:verify-certificate no; set net:max-retries 0; set net:reconnect-interval-base 30; set net:reconnect-interval-multiplier 1 && open -u USER,PASSWORD SERVER_NAME_OR_IP && mirror -n Local_Folder Remote_Folder"

You can run it inside screen . It will connect per 30 seconds intervals and download if any new files exits without any common error.

Another easy but working option is using ncftp. It is not in default installation and mostly you can install it using apt repo.

sudo apt-get install ncftp

then use screen or nohup to run command in background so even if you are disconnected from terminal, it works.

Use it in following way


So, it will run ncftpget per 30 seconds to download the new file. Then disconnect from the screen terminal and it will run in background.

Saving it for future use to I don't need to remember it and it may can help you ?!