Title: foldersize.sh.2014.04.09
Created: 2018-04-29 22:33:01 +0000

This code adds the folder size to the end of the name of the folder.

#!/bin/bash

DIRSIZE=`du -hs "$1" | cut -f 1`

NOSPACE=`echo "${DIRSIZE// /}"`

NEW_NAME="$1_($NOSPACE)"

echo Changing name to: "$NEW_NAME"

mv "$1" "$NEW_NAME"

exit 0