With this part of script I can get a necessary information about files in my directory(and subdirectories). The only information I need is the extension and the size of file.
for file in `find . -type f`; do
size=$(stat -c '%s' ${file})
file=$(echo "${file}" | awk -F/ '{print $NF}')
ext=$(echo "${file}" | grep '..*.' | awk -F. '{print $NF}' | grep '[A-Za-z0-9]')
if [ -z ${ext} ]; then
echo "NOTE: no extention"
else
EXTS="${EXTS}${ext}${newLine}"
It is only part of the script. So my question is: How can I put this informarion into an array? I mean I want an array with elements to look like this:
c/123 /12 h/90 /0 txt/0
where c, h and txt are file extension and 123, 12 and 0 are file sizes. So lately I can separately work with sizes and extensions
I hope, I've neatly put my question down. Sorry for mistakes. :)