Skip to content

Instantly share code, notes, and snippets.

@sydneyitguy
Last active December 14, 2015 18:49
Show Gist options
  • Save sydneyitguy/5132030 to your computer and use it in GitHub Desktop.
Save sydneyitguy/5132030 to your computer and use it in GitHub Desktop.
Clear all rails log files under the current directory
# Remove all Thumbs.db files reculsively from current directory
find ./ -name "Thumbs.db" -exec rm '{}' \;
# Restore default permissions
chmod 755 $(find ./ -type d) && chmod 644 $(find ./ -type f)
#!/bin/bash
#
# Find all the rails projects from this directory down and clear their log
# files to save some space.
#
base=`pwd`
for path in `find $base -type f -path '*/config/environment.rb'`
do
rails_root=`echo $path | xargs dirname | xargs dirname`
echo "Found RAILS_ROOT in $rails_root"
old_pwd=`pwd`
cd $rails_root
rm log/*
cd $old_pwd
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment