Quote:
Originally Posted by ashi.srma1986
Sir i work with a company where we have to download files from ftp server. its newsprint company so time means a lot to us. now we need a person to keep looking into ftp folder. i want only that when someone put something into our ftp folder then the file start downloading by itself into my local drive but the below script is doing reverse. this script deleting the file on remote computer.
|
You need to realize that this is a VOLUNTEER forum...this is NOT URGENT for us in any way. If you are employed by a company to perform a job, then
YOU need to be in a hurry, not us. Telling us "time means a lot to us", doesn't get us to help you quicker. Also, if you're in such a hurry, you may want to consider
actually posting WHAT PROBLEMS you're having, other than just saying "i have a problem", or "its not working". Those give us NO details as to what error(s)/message(s) you're seeing. If it's REALLY urgent for you, then HIRE SOMEONE to do this. You re-posted a question after SEVEN MINUTES, asking for help. We don't just sit here and wait for you to post.
Quote:
Code:
#!/bin/bash
HOST='10.7.3.184'
USER='vm'
PASS='vm'
SOURCEFOLDER='/disk1/ftp'
TARGETFOLDER='/test'
lftp -f "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
cd $TARGETFOLDER
mirror --reverse --delete --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"
|
Again, as has been suggested several times now, why aren't you using rsync or wget?? Those are the best tools for the job. And the very first hit in Google for "linux bash script to automate ftp transfers" is:
https://www.linux.com/community/blog...ersonal/386522
...complete with a working example. Change the commands to get the files and delete them. Since time means a lot to you, doing research on your own is a great place to start.