Skip to content

Instantly share code, notes, and snippets.

@jmatsu
Last active August 29, 2015 14:23
Show Gist options
  • Save jmatsu/74fcfe62a0413cf021e8 to your computer and use it in GitHub Desktop.
Save jmatsu/74fcfe62a0413cf021e8 to your computer and use it in GitHub Desktop.
便利系
# 解凍
for tgz in `find . -maxdepth 1 -type f -iname \*.tgz`; do
tar -xvf $tgz
done
# ゴミ処理
for garbage in `find -E . -type f -iregex '^(\._.*|.*\~|#.*|.*\.DS_Store)$'`; do
rm $garbage
done
# recursive removal can be realized by deleting "-maxdepth 1"
rm_zero_f() {
for _FILE in `find . -type f -maxdepth 1`; do [ ! -s $_FILE ] && rm $_FILE; done
}
# script location (consider symbolic)
_MY_LOCATION="$(\cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; _pwd=`pwd`/${_MY_NAME};
\cd "$(dirname `readlink -f ${_pwd} 2> /dev/null||readlink ${_pwd}`)" ; pwd)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment