You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
530 B
JavaScript
23 lines
530 B
JavaScript
#!/usr/bin/env node
|
|
var glob = require('glob');
|
|
var fs = require('fs');
|
|
|
|
function pad(num, size) {
|
|
var str = num.toString();
|
|
while (str.length < size) {
|
|
str = '0' + str;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
glob(__dirname + '/../data/slide/*.md', function (err, files) {
|
|
if (err) { return console.log(err); }
|
|
files.sort();
|
|
files.forEach(function (file, index) {
|
|
var newFile = file.replace(/\d\d\d/, pad((index + 1) * 10, 3));
|
|
fs.rename(file, newFile, function () {
|
|
console.log(file, '→', newFile);
|
|
});
|
|
});
|
|
});
|