UNPKG

shubhadownloader

Version:

There is large amount of information available in market place. The markets are always in sync. In today's world investors find it very difficult to make effective use of information available to them. Shubha Downloader is great tool which resolves this problem and helps investor to increase his productivity and stay focused on decision making. Shubha Downloader enable end user to download market data from available sources and organize it. Shubha Downloader is Open source & FREE utility for end users. Shubha Downloader have main features as follows End of the day market data from web to your favorite charting application . Fundamental market data from web to your favorite charting application. Market reports from web to your favorite charting application.

936 lines (784 loc) 44.3 kB
/*********************** Company Name:XNet Inc. Last Modified Date:17-Jan-2013 Author: Prashant Shilimkar Description :This page will download mcx bhavcopy csv file from site http://www.mcxindia.com/SitePages/BhavCopyDateWise.aspx given date. *************************/ /******************************** <Shubha Downloader, It downloads end of day pricing data from publicly available sites and converts it different formats....> Copyright (C) 2013 Shubhalabha.in This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/> ***********************************/ function mcx_Future_IndexHistory(count,n,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,sn) { try { var mon=count[0].split('-')[0]; var m1=count[0].split('-')[1]; var d=count[0].split('-')[2]; var yy=count[0].split('-')[3]; var y=yy.substr(2,2); var endmon=count[count.length-1].split('-')[0]; var endm1=count[count.length-1].split('-')[1]; var endd=count[count.length-1].split('-')[2]; var endyy=count[count.length-1].split('-')[3]; var y=endyy.substr(2,2); var intMonth =getMonth(mon); var endintMonth =getMonth(endmon); var startDateForDownloadMCXFutureIndexHistory = intMonth+'/'+d+'/'+yy; var endDateForDownloadMCXFutureIndexHistory = endintMonth+'/'+endd+'/'+endyy; var strFileNameIndexHistory = intMonth+''+d+''+yy+'_to_'+endintMonth+''+endd+''+endyy; var arrIndexValues = ['323','324','325','326']; var arrSpotIndexValues = ['327','328','329','330']; startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, 0, strFileNameIndexHistory); /************/ visit('indices.html'); /***************/ function startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory) { /*console.log('\n for n='+n+' index val: '+arrIndexValues[n]); console.log('\n st:'+startDateForDownloadMCXFutureIndexHistory); console.log('\n end:'+endDateForDownloadMCXFutureIndexHistory); */ try { document.getElementById("om").innerHTML+="<br/>MCXIndex"+arrIndexValues[n]+".csv is downloading"; fs = require('fs'); var csv = require('ya-csv'); var async = require('async'); var htmlparser = require("htmlparser"); var DomHandler = require("DomHandler"); var DomElementType = require('DomElementType'); var http = require('http'), fs = require('fs'), request = require('request'); var urlStockinfo = "http://www.mcxindia.com/SitePages/indexhistory.aspx"; // url to which request have to post var r = request.get(urlStockinfo); // This request is for to get __VIEWSTATE and __EVENTVALIDATION values var resData = ""; var resData1 = ""; var fileNameCsv = ""; var outCsv = ""; if(arrIndexValues[n] !== '' && arrIndexValues[n] != null) { //fileNameCsv = downloadpath+"mcxindia/MCXIndex"+arrIndexValues[n]+'_'+strFileNameIndexHistory+".csv" fileNameCsv = downloadpath+"mcxindia/MCXIndex"+arrIndexValues[n]+".csv" outCsv = fs.createWriteStream(fileNameCsv); } r.on('response', function(response) { response.on('data', function(chunk) { // console.log('\n data = '+chunk); resData += chunk; }); }); r.on('error',function(){ startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); }); r.on('end', function () { var viewState_value = ""; var eventValidation_value = ""; var mImgBtnGo_X = ""; try{ // Parsing html for getting value of __VIEWSTATE var parser = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__VIEWSTATE"){ viewState_value = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser.write(resData); parser.done(); // Parsing html for getting value of __EVENTVALIDATION var parser1 = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__EVENTVALIDATION"){ eventValidation_value = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser1.write(resData); parser1.done(); new htmlparser.FeedHandler(function(error, feed){ console.log('\n Error : '+error); }); //console.log('\n viewstate value is : '+viewState_value); //console.log('\n eventvalidation value is : '+eventValidation_value); }catch(err) { if(err){ document.getElementById("om").innerHTML+="<br/>"+err; } } var r1 = request // This request to load data of given date and set x and y co-ordinates to mImgBtnGo using __VIEWSTATE and __EVENTVALIDATION values ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", //"Referer": "http://www.mcxindia.com", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form:{ '__VIEWSTATE':viewState_value.trim(), '__EVENTVALIDATION':eventValidation_value.trim(), 'mDdlOtherIndex':arrIndexValues[n], 'mRbtLstSpotFut_0':'1', 'mTbFromDate':startDateForDownloadMCXFutureIndexHistory, 'mTbToDate':endDateForDownloadMCXFutureIndexHistory, 'mBtnGo.x':'130', 'mBtnGo.y':'40' } //,'__EVENTTARGET':'btnLink_Excel'}//,'__EVENTARGUMENT':'Page$2'} } ); r1.on('response', function(response) { response.on('data', function(chunk) { resData1 += chunk; }); }); var viewState_value1 = ""; var eventValidation_value1 = ""; r1.on('error',function(){ startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); }); r1.on('end', function() { //console.log('\n'+resData1) try{ // Parsing html for getting value of __VIEWSTATE var parser2 = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__VIEWSTATE"){ viewState_value1 = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser2.write(resData1); parser2.done(); // Parsing html for getting value of __EVENTVALIDATION var parser3 = new htmlparser.Parser( { onopentag: function(name, attribs) { if(name === "input" && attribs["id"] === "__EVENTVALIDATION"){ eventValidation_value1 = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser3.write(resData1); parser3.done(); new htmlparser.FeedHandler(function(error, feed){ console.log('\n Error : '+error); }); }catch(err) { if(err){ document.getElementById("om").innerHTML+="<br/>"+err; } } //console.log('\n viewstate 1 value is : '+viewState_value1); // console.log('\n eventvalidation 1 value is : '+eventValidation_value1); // This request is for to download loaded data (ie csv) by above request using __VIEWSTATE and __EVENTVALIDATION values /*************Cehcking for the status code**********/ request ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form:{ '__VIEWSTATE':viewState_value1.trim(), '__EVENTVALIDATION':eventValidation_value1.trim(), 'mDdlOtherIndex':arrIndexValues[n], 'mRbtLstSpotFut_0':'1', 'mTbFromDate':startDateForDownloadMCXFutureIndexHistory, 'mTbToDate':endDateForDownloadMCXFutureIndexHistory, '__EVENTTARGET':'linkButton' } }, function(error, response, body) { if(response != null) { if(response.statusCode != null || response.statusCode != "") { if (!error && response.statusCode == 200) { downloadmcxcsv(response.statusCode); } else { downloadmcxcsv(404); } }else { downloadmcxcsv(404); } }else { downloadmcxcsv(404); } } ); /**************************end of checking status code****/ function downloadmcxcsv(code){ if(code==200){ var r2 = request ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form:{ '__VIEWSTATE':viewState_value1.trim(), '__EVENTVALIDATION':eventValidation_value1.trim(), 'mDdlOtherIndex':arrIndexValues[n], 'mRbtLstSpotFut_0':'1', 'mTbFromDate':startDateForDownloadMCXFutureIndexHistory, 'mTbToDate':endDateForDownloadMCXFutureIndexHistory, '__EVENTTARGET':'linkButton' } } ); r2.pipe(outCsv); r2.on('end',function(){ n++; if(arrIndexValues.length > n) { loadprogressbar(); setTimeout(function(){ startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); },1000); }else { Ext.getCmp('pbar3').updateText('NSEL EOD Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.05); setTimeout(function() { var om=322; while(om<327){ process_mcxindex(count,om,baseurl,downloadpath,unzippath,outputpath,logpath); om++; } startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, 0, strFileNameIndexHistory); },5000); } }); r2.on('error',function(){ startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory) }); } else { n++; if(arrIndexValues.length > n) { loadprogressbar(); setTimeout(function(){ startProcessForMCXFutureIndexHistory(arrSpotIndexValues, arrIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); },1000); }else { Ext.getCmp('pbar3').updateText('NSEL EOD Processing is started . . .'); Ext.getCmp('pbar3').updateProgress(0.05); setTimeout(function() { var om=322; while(om<327){ process_mcxindex(count,om,baseurl,downloadpath,unzippath,outputpath,logpath); om++; } startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, 0, strFileNameIndexHistory); },5000); //setTimeout(function(){var om=323;while(om<327){process_mcxindex(count,om,baseurl,downloadpath,unzippath,outputpath,logpath);om++;}},5000); //startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, 0, strFileNameIndexHistory); } } } }); }); }catch(err) { if(err){ document.getElementById("om").innerHTML+="<br/>"+err; } } } function startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory) { //console.log('\n for n='+n+' Sopt index val: '+arrSpotIndexValues[n]); //console.log('\n spot st:'+startDateForDownloadMCXFutureIndexHistory); //console.log('\n spot end:'+endDateForDownloadMCXFutureIndexHistory); try { document.getElementById("om").innerHTML+="<br/>MCXSpotIndex"+arrSpotIndexValues[n]+".csv is downloading"; fs = require('fs'); var csv = require('ya-csv'); var async = require('async'); var htmlparser = require("htmlparser"); var DomHandler = require("DomHandler"); var DomElementType = require('DomElementType'); var http = require('http'), fs = require('fs'), request = require('request'); var urlStockinfo = "http://www.mcxindia.com/SitePages/indexhistory.aspx"; // url to which request have to post var r = request.get(urlStockinfo); // This request is for to get __VIEWSTATE and __EVENTVALIDATION values var resData = ""; var resData1 = ""; var outCsv; var fileNameCsv = ""; if(arrSpotIndexValues[n] !== '' && arrSpotIndexValues[n] != null) { fileNameCsv = downloadpath+"mcxindia/MCXSpotIndex"+arrSpotIndexValues[n]+".csv" outCsv = fs.createWriteStream(fileNameCsv); } r.on('response', function(response) { response.on('data', function(chunk) { resData += chunk; }); }); r.on('error',function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); }); r.on('end', function () { var viewState_value = ""; var eventValidation_value = ""; var mImgBtnGo_X = ""; try{ var parser = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__VIEWSTATE"){ viewState_value = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser.write(resData); parser.done(); var parser1 = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__EVENTVALIDATION"){ eventValidation_value = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser1.write(resData); parser1.done(); new htmlparser.FeedHandler(function(error, feed){ console.log('\n Error : '+error); }); }catch(err) { if(err){ document.getElementById("om").innerHTML+="<br/>"+err; } } var r1 = request // This request to load data for spot index using __VIEWSTATE and __EVENTVALIDATION values ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form: { '__VIEWSTATE':viewState_value.trim(), '__EVENTVALIDATION':eventValidation_value.trim(), 'mRbtLstSpotFut':'0' } } ); r1.on('response', function(response) { response.on('data', function(chunk) { resData1 += chunk; }); }); var viewState_value1 = ""; var eventValidation_value1 = ""; r1.on('error',function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); }); r1.on('end', function() { try { // Parsing html for getting value of __VIEWSTATE var parser2 = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__VIEWSTATE"){ viewState_value1 = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser2.write(resData1); parser2.done(); // Parsing html for getting value of __EVENTVALIDATION var parser3 = new htmlparser.Parser( { onopentag: function(name, attribs) { if(name === "input" && attribs["id"] === "__EVENTVALIDATION"){ eventValidation_value1 = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser3.write(resData1); parser3.done(); new htmlparser.FeedHandler(function(error, feed){ console.log('\n Error : '+error); }); }catch(err) { if(err){ document.getElementById("om").innerHTML+="<br/>"+err; } } var resData4 = ""; var r4 = request // This request to load data of given date and option and set x and y co-ordinates to mImgBtnGo using __VIEWSTATE and __EVENTVALIDATION values ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form: { '__VIEWSTATE':viewState_value1.trim(), '__EVENTVALIDATION':eventValidation_value1.trim(), 'mDdlOtherIndex':arrSpotIndexValues[n], 'mTbFromDate':startDateForDownloadMCXFutureIndexHistory, 'mTbToDate':endDateForDownloadMCXFutureIndexHistory, 'mBtnGo.x':'130', 'mBtnGo.y':'40' } } ); r4.on('response', function(response) { response.on('data', function(chunk) { resData4 += chunk; }); }); var viewState_value4 = ""; var eventValidation_value4 = ""; r4.on('error',function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); }); r4.on('end', function() { try{ // Parsing html for getting value of __VIEWSTATE var parser4 = new htmlparser.Parser( { onopentag: function(name, attribs){ if(name === "input" && attribs["id"] === "__VIEWSTATE"){ viewState_value4 = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser4.write(resData4); parser4.done(); // Parsing html for getting value of __EVENTVALIDATION var parser5 = new htmlparser.Parser( { onopentag: function(name, attribs) { if(name === "input" && attribs["id"] === "__EVENTVALIDATION"){ eventValidation_value4 = attribs["value"]; } }, ontext:function(text){ }, onclosetag: function(tagname){ } }); parser5.write(resData4); parser5.done(); new htmlparser.FeedHandler(function(error, feed){ console.log('\n Error : '+error); }); }catch(err) { if(err){ document.getElementById("om").innerHTML+="<br/>"+err; } } // This request is for to download loaded data (ie csv) by above request using __VIEWSTATE and __EVENTVALIDATION values /*************Cehcking for the status code**********/ request ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form: { '__VIEWSTATE':viewState_value4.trim(), '__EVENTVALIDATION':eventValidation_value4.trim(), 'mDdlOtherIndex':arrSpotIndexValues[n], 'mTbFromDate':startDateForDownloadMCXFutureIndexHistory, 'mTbToDate':endDateForDownloadMCXFutureIndexHistory, '__EVENTTARGET':'linkButton' } }, function(error, response, body) { if(response != null) { if(response.statusCode != null || response.statusCode != "") { if (!error && response.statusCode == 200) { downloadmcxcsv(response.statusCode); } else { downloadmcxcsv(404); } }else { downloadmcxcsv(404); } }else { downloadmcxcsv(404); } } ); /**************************end of checking status code****/ function downloadmcxcsv(code){ if(code==200){ var r2 = request ( { method: 'POST', uri: urlStockinfo, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11", "Accept-Encoding": "utf-8", "Accept": "text/plain,application/csv,*/*;q=0.3", "Cookie": "cookie" }, form: { '__VIEWSTATE':viewState_value4.trim(), '__EVENTVALIDATION':eventValidation_value4.trim(), 'mDdlOtherIndex':arrSpotIndexValues[n], 'mTbFromDate':startDateForDownloadMCXFutureIndexHistory, 'mTbToDate':endDateForDownloadMCXFutureIndexHistory, '__EVENTTARGET':'linkButton' } } ); r2.pipe(outCsv); r2.on('end',function(){ document.getElementById("om").innerHTML+="<br/>MCXSpotIndex"+arrSpotIndexValues[n]+".csv is downloaded" n++; if(arrIndexValues.length > n) { loadprogressbar(); setTimeout(function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); },1000); }else { Ext.getCmp('pbar3').updateProgress(0.005); setTimeout(function(){ var om=327; while(om<331) { process_mcxspotindex(count,om,baseurl,downloadpath,unzippath,outputpath,logpath); om++; } sn++; callfun(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,sn); },5000); } }); r2.on('error',function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); }); } else { document.getElementById("om").innerHTML+="<br/>MCXSpotIndex"+arrSpotIndexValues[n]+".csv is not downloaded" n++; if(arrIndexValues.length > n) { loadprogressbar(); setTimeout(function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); },1000); }else { Ext.getCmp('pbar3').updateProgress(0.005); setTimeout(function(){ var om=327; while(om<331) { process_mcxspotindex(count,om,baseurl,downloadpath,unzippath,outputpath,logpath); om++; } sn++; callfun(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,sn); },5000); } } } }); }); }); }catch(err) { console.error(err.stack); document.getElementById("om").innerHTML+="<br/>MCXSpotIndex"+arrSpotIndexValues[n]+".csv is not downloaded" n++; if(arrIndexValues.length > n) { loadprogressbar(); setTimeout(function(){ startProcessForMCXSpotIndexHistory(arrSpotIndexValues, startDateForDownloadMCXFutureIndexHistory, endDateForDownloadMCXFutureIndexHistory, outputpath, n, strFileNameIndexHistory); },1000); }else { Ext.getCmp('pbar3').updateProgress(0.005); setTimeout(function(){ var om=327; while(om<331) { process_mcxspotindex(count,om,baseurl,downloadpath,unzippath,outputpath,logpath); om++; } sn++; callfun(count,baseurl,downloadpath,unzippath,outputpath,logpath,fromd,tod,sn); },5000); } } } function getMonth(mon){ var month=''; switch(mon.toUpperCase()) { case 'JAN': month='01'; break; case 'FEB': month='02'; break; case 'MAR': month='03'; break; case 'APR': month='04'; break; case 'MAY': month='05'; break; case 'JUN': month='06'; break; case 'JUL': month='07'; break; case 'AUG': month='08'; break; case 'SEP': month='09'; break; case 'OCT': month='10'; break; case 'NOV': month='11'; break; case 'DEC': month='12'; break; } return month; } }catch(err) { console.log(err); } }