Skip to content

Instantly share code, notes, and snippets.

@tjwebb
Last active February 21, 2017 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjwebb/6fc20623c23193f976040660c34b5ced to your computer and use it in GitHub Desktop.
Save tjwebb/6fc20623c23193f976040660c34b5ced to your computer and use it in GitHub Desktop.
const dir = '.' // set dir
const co = require('co')
const fs = require('mz/fs')
co(function *() {
const files = yield fs.readdir(dir)
for (const f of files) {
if (/\.csv$/.test(f)) {
yield fs.rename(f, f.replace(/\.csv$/, '.txt'))
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment