Skip to content

Instantly share code, notes, and snippets.

@ecto
Created January 24, 2011 21:35
Show Gist options
  • Save ecto/794008 to your computer and use it in GitHub Desktop.
Save ecto/794008 to your computer and use it in GitHub Desktop.
Used to process new images into Redis for our FaceMash clone
var fs = require('fs'),
redis = require('redis-node'),
db = redis.createClient(),
exec = require('child_process').exec;
var files = fs.readdirSync('./new')
files.forEach(function(file){
db.incr('images', function(err, id){
db.set('image:' + id + ':rating', '1000');
db.set('image:' + id + ':location', file);
console.log(file);
});
});
exec('mv new/* static/images/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment