Skip to content

Instantly share code, notes, and snippets.

@tiye
Created April 22, 2012 02:59
Show Gist options
  • Save tiye/2444248 to your computer and use it in GitHub Desktop.
Save tiye/2444248 to your computer and use it in GitHub Desktop.
reset the fole modes after reinstall Ubuntu
# this is a CoffeeScript file
# put this file at the top level of file tree
# run with 'coffee ugo_reset.coffee'
fs = require 'fs'
path = require 'path'
ll = console.log
list_files = (dir_name) ->
files = fs.readdirSync dir_name
for file_name in files
child_path = path.join dir_name, file_name
stat = fs.statSync child_path
if stat.isDirectory()
fs.chmodSync child_path, '755'
list_files child_path
else
fs.chmodSync child_path, '644'
list_files '.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment