Social Icons

Pages

Thursday, October 24, 2013

Windows Auto FTP Program to Transfer file to a Webhost

Lately I've been searching the internet for a windows bat program file that could be integrated with the windows scheduled task to transfer files from a Windows PC to a folder in my webhost. I have to use that program sync data gathered from a certain desktop program. The desktop program generates csv(comma separated values) that contains informations that I can insert to a database and ultimately used by my php program to generate reports for my client. Through some research and experimenting. I think I found a way to do it. I don't know if this method is already published elsewhere but I will just post this to serve as my reference in case I will ever again need this.

You have to create a bat file with this codes:
ftp -n -i -s:getfile.txt >>log.txt
 And as you can see it calls for a text file with the filename getfile.txt. The last file is the log file. You can name this file anyway you want and must contain below codes(at least this works for my purpose, you can add other commands if you want).

open put_host_here
user put_username put_password_here
cd put_path
mput filename.csv
close
bye

Place both file in same folder. You can now call this bat file through a scheduled task. And thats it. You should have stable internet connection though.

0 comments:

Post a Comment

 

You may want to check

Followers

Visitors Counter

Total Pageviews