Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save grzegorzblaszczyk/6eb9440e0085ac3da056f7d23d730fb0 to your computer and use it in GitHub Desktop.
Save grzegorzblaszczyk/6eb9440e0085ac3da056f7d23d730fb0 to your computer and use it in GitHub Desktop.
Freeup log files in workspace
#!/bin/bash
AWK=`which awk`
FIND=`which find`
GREP=`which grep`
LS=`which ls`
echo "Getting the log files..."
FILES=`${FIND} . -name "*.log" | ${GREP} "/log/"`
echo "Freeing up the disk space..."
for file in $FILES; do
FILE_SIZE=`${LS} -lh ${file} | ${AWK} '{print $5}' `
echo "Emptying $file file (${FILE_SIZE}) ..."
echo -n "" > $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment