Created
April 22, 2012 02:59
-
-
Save tiye/2444248 to your computer and use it in GitHub Desktop.
reset the fole modes after reinstall Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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