I need to build a shell script to run daily & upload certain files to an FTP. I thought I'd use FTP, but I'm really not sure how to use FTP in a shell script being run by a cron job.

Can anyone give me an insight to how I'd upload a file view FTP in a command?

Thanks for your time.

You could create a script:

#!/bin/bash
ftp -n 10.2.1.2 <<!
user "username" "password"
put /tmp/upload.txt upload.txt
bye
!

Sample usage:

sk@svn2:/tmp$ cat ftp.sh
#!/bin/bash
ftp -n 10.2.1.2 <<!
user "username" "password"
put /tmp/upload.txt upload.txt
bye
!
sk@svn2:/tmp$ ./ftp.sh
commented: Answered! +2

Thank you it worked just fine!

Happy to help :)

Please mark this thread as solved if you have found an answer to your question and good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.