{"id":335,"date":"2011-08-24T21:34:14","date_gmt":"2011-08-24T21:34:14","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=335"},"modified":"2013-05-22T12:15:35","modified_gmt":"2013-05-22T10:15:35","slug":"merging-columns-in-mysql","status":"publish","type":"post","link":"http:\/\/www.extradrm.com\/?p=335","title":{"rendered":"FTP scheduling File transfers under DOS \/ Windows"},"content":{"rendered":"<p>In order to make a secure backup on a distant server or hosting cloud, The FTP command support the &#8220;-s:ftpscript.txt&#8221; option. The FTP commands listed in ftpscript.txt will automatically run after FTP starts. The FTP command can be started from a batch file.<\/p>\n<p>Example:<\/p>\n<pre>FTP -v -i -s:ftpscript.txt<\/pre>\n<p>&nbsp;<\/p>\n<p>Create ftp script file (ftpscript.txt)<\/p>\n<pre>open &lt;your server&gt;\r\n&lt;username&gt;\r\n&lt;password&gt;\r\nlcd  &lt;your folder to upload&gt;\r\ncd &lt;your server folder to hold backup&gt;\r\nbinary\r\nmput \"*.*\"\r\ndisconnect\r\nbye<\/pre>\n<p>It can be useful to remember those transfer ftp instruction :<\/p>\n<h3>FTP Download instructions server -&gt; local<\/h3>\n<pre>get\r\nget home.html\r\nmget  (multi files instruction)\r\nmget *.html<\/pre>\n<h3>FTP Upload instructions Transfer from local to server (upload)<\/h3>\n<pre>put\r\nmput (Multi-files instruction)<\/pre>\n<p>Now, you can add as the following line to your regular dumping mysql database batch :<\/p>\n<pre>@echo off\r\necho Running dump...\r\nc:binmysqldump -u[user] -p[password] --result-file=\"c:backup.%DATE:~0,3%.sql\" [database]\r\nftp -v -i -s:ftpscript.txt\r\necho Done!<\/pre>\n<p>Another way to do a complete batch script can be this way on windows server 2003 :<\/p>\n<pre>\r\n@echo off\r\n\r\n# variable to hold the datestamp of the backup\r\nSET today=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%\r\n\r\n# temporary FTP script to upload backup files\r\nset SCRIPT_NAME=ftp_script.ftp\r\n\r\n# MySQL database dump\r\n\"C:\\wamp\\bin\\mysql\\mysql5.5.24\\bin\\mysqldump\" planning -u root > \"C:\\wamp\\sql_backup\\%today%_planning.sql\"\r\n\r\n# connect to FTP server, provide credentials and perform upload\r\nftp>> %SCRIPT_NAME%\r\nopen YOUR_IP>> %SCRIPT_NAME%\r\nYOUR_user>> %SCRIPT_NAME%\r\nYOUR_password>> %SCRIPT_NAME%\r\ncd  YOUR_DIRECTORY>> %SCRIPT_NAME%\r\nbinary>> %SCRIPT_NAME%\r\nput %today%_planning.sql>> %SCRIPT_NAME%\r\ndisconnect>> %SCRIPT_NAME%\r\nbye>> %SCRIPT_NAME%\r\nftp -s:%SCRIPT_NAME%\r\n\r\n# always clean behind\r\n@del %SCRIPT_NAME% \/q\r\n#@del %today%_planning.sql (You can delete local backups after upload)\r\n<\/pre>\n<p>Cheers,<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to make a secure backup on a distant server or hosting cloud, The FTP command support the &#8220;-s:ftpscript.txt&#8221; option. The FTP commands listed in ftpscript.txt will automatically run after FTP starts. The&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2845,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[30,23,35],"tags":[123],"youtube_video":null,"_links":{"self":[{"href":"http:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/335"}],"collection":[{"href":"http:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=335"}],"version-history":[{"count":0,"href":"http:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/335\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2845"}],"wp:attachment":[{"href":"http:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=335"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}