I'm trying to find a way to combine the results that are displayed with the find
command, e.g:
$find /home -name "requirements_*"
/home/cobayo/Obligatorio Test 2/requirements_richard
/home/cobayo/Obligatorio Test 2/requirements_paul
/home/cobayo/Obligatorio Test 2/requirements_george
/home/cobayo/Obligatorio Test 1/Subdirectorio/requirements_joe
So here I get all of the paths of the files I am looking for, what I would like to do is to get the file size listed prior the paths. For instance:
34K "/home/cobayo/Obligatorio Test 2/requirements_richard"
I have some commands, even a little script does show me file sizes.
For example, this one:
find /home -name "requirements_*" -mtime -1 -print0 | du --files0-from=- -hc |
tail -n1*
And it shows the TOTAL size of all files with the name given as a parameter as results.
But then, I also have this little script:
FILENAME=$1
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
Which is perfect as I get the file in K of the specific file. I tried to mix them up using a list:
*for i in `find /home -name "requirements_*"`
do
echo `stat -c%s $i`
done*
But I don't get the results Im looking for, in fact it tells me the files don't exist :(