User Tools

Site Tools


eric:computer:bash:shell_scripting:foldersize.sh.2014.04.09

This is an old revision of the document!


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
eric/computer/bash/shell_scripting/foldersize.sh.2014.04.09.1791489879.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki