Batch File to Upload A Plugin To All My Sites
Posted on February 13, 2010
Filed Under Affiliate Marketing | Leave a Comment
So I was getting tired of making revisions to my plugins and having to go back and upload it to each site manually. I did some digging and found a way to automate this process.
1st step: Create a batch file with the following contents and call it fileup.bat
@echo off
echo user %1> ftpcmd.dat
echo %2>> ftpcmd.dat
echo bin>> ftpcmd.dat
echo cd /www/wp-content/plugins/pluginname/>>ftpcmd.dat
echo put %3>> ftpcmd.dat
echo quit>> ftpcmd.dat
ftp -n -s:ftpcmd.dat %4
del ftpcmd.dat
The %1 -4 are variables that we will pass to the batch file when we call it.
%1 = username
%2 = password
%3 = filename
%4 = ftp host
Depending on your host I would think you might have to edit the directory location for the plugins.
2nd Step: Create anothe batch file to make all the calls and name it whatever you would like.
call fileup username password widgetfilename.php ftp.domain1.com
call fileup username password widgetfilename.php ftp.domain2.com
call fileup username password widgetfilename.php ftp.domain3.com
call fileup username password widgetfilename.php ftp.domain4.com
pause
Make sure both batch files and the file you are uploading are all in the same directory. I put the pause at the end so that you can scroll up and verify that all the files transferred successfully. I just set this up this evening and it is working great. Now with every site I create I will add an entry to the second batch file.
This would allow me to say switch from EPN to Amazon in the click of a button after I just edit my plugins and quickly upload them to all my sites with this batch file. So this is key when and if something would ever happen that I had to quickly make a mass change.
Thanks to howtogeek.com for a great article that got me started in the right direction for what I was trying to do here.
I hope this helps some people out. I sure know it is going to save me some time!
Comments
Leave a Reply


