kewlhotrod

Untitled

Jul 1st, 2013
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. root@fuzzyhost:~/NodeScripts# node shoutcastmkdir.js
  2.  
  3. /root/NodeScripts/shoutcastmkdir.js:15
  4. GLOBAL.num = olddata.match(/^Name(.*)$/g);
  5. ^
  6. TypeError: Object Name0
  7. has no method 'match'
  8. at /root/NodeScripts/shoutcastmkdir.js:15:23
  9. at fs.js:266:14
  10. at Object.oncomplete (fs.js:107:15)
  11. root@fuzzyhost:~/NodeScripts#
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19. var sys = require('sys');
  20. var exec = require('child_process').exec;
  21. var name = "Name"
  22. var sys = require('sys')
  23. var exec = require('child_process').exec;
  24.  
  25. var fs = require('fs');
  26.  
  27.  
  28. fs.readFile('/home/shoutcast/lastdir', function (err, olddata) {
  29. if (err) {
  30. return console.log(err);
  31. }
  32. GLOBAL.olddir = olddata.toString()
  33. GLOBAL.num = olddata.match(/^Name(.*)$/g);
  34. GLOBAL.number = num ++
  35. GLOBAL.path = olddata.toString().replace('Name', 'Name'); + number
  36. console.log(olddir.toString() + " Old Directory");
  37. console.log(path.toString() + " New Directory");
  38.  
  39. });
  40.  
  41. fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
  42. if (err) {
  43. return console.log(err);
  44. }
  45. console.log(data.toString());
  46. var result = data.toString().replace('NEWDIR="' + olddir + '"', 'NEWDIR="' + path + '"');
  47.  
  48. fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
  49. if (err) return console.log(err);
  50. function puts(error, stdout, stderr) { sys.puts(stdout) }
  51. exec("bash /home/shoutcast/mkdir.sh", puts);
  52.  
  53. });
  54.  
  55.  
  56.  
  57. fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
  58. if (err) return console.log(err);
  59. });
  60.  
  61. function puts(error, stdout, stderr) { sys.puts(stdout) }
  62. exec("ls -la /home/shoutcast", puts);
  63.  
  64.  
  65. });
Advertisement
Add Comment
Please, Sign In to add comment