Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@fuzzyhost:~/NodeScripts# node shoutcastmkdir.js
- /root/NodeScripts/shoutcastmkdir.js:15
- GLOBAL.num = olddata.match(/^Name(.*)$/g);
- ^
- TypeError: Object Name0
- has no method 'match'
- at /root/NodeScripts/shoutcastmkdir.js:15:23
- at fs.js:266:14
- at Object.oncomplete (fs.js:107:15)
- root@fuzzyhost:~/NodeScripts#
- var sys = require('sys');
- var exec = require('child_process').exec;
- var name = "Name"
- var sys = require('sys')
- var exec = require('child_process').exec;
- var fs = require('fs');
- fs.readFile('/home/shoutcast/lastdir', function (err, olddata) {
- if (err) {
- return console.log(err);
- }
- GLOBAL.olddir = olddata.toString()
- GLOBAL.num = olddata.match(/^Name(.*)$/g);
- GLOBAL.number = num ++
- GLOBAL.path = olddata.toString().replace('Name', 'Name'); + number
- console.log(olddir.toString() + " Old Directory");
- console.log(path.toString() + " New Directory");
- });
- fs.readFile('/home/shoutcast/mkdir.sh', function (err, data) {
- if (err) {
- return console.log(err);
- }
- console.log(data.toString());
- var result = data.toString().replace('NEWDIR="' + olddir + '"', 'NEWDIR="' + path + '"');
- fs.writeFile('/home/shoutcast/mkdir.sh', result, function (err) {
- if (err) return console.log(err);
- function puts(error, stdout, stderr) { sys.puts(stdout) }
- exec("bash /home/shoutcast/mkdir.sh", puts);
- });
- fs.writeFile('/home/shoutcast/lastdir', path, function (err) {
- if (err) return console.log(err);
- });
- function puts(error, stdout, stderr) { sys.puts(stdout) }
- exec("ls -la /home/shoutcast", puts);
- });
Advertisement
Add Comment
Please, Sign In to add comment