Hello. I do have a problem.
The statement sounds like this: Given a directory, find all subdirectories (regardless of depth) which contain a file that has more than a half of the size of the respective subdirectory.
I've tried to solve this in many ways, but all I came up with is half solutions.
One would be trying this:
find folder -type f -size +x
where I would search for the size of each file, x being a variable, but this should be applied to each file.
Another one, which seems not to work, would be this:
for i in $(ls $1); do
if [ -d $i ]; then
echo $i;
fi;
done
but still, i should search for each file and compare it with the directory.
trying
ls -R folder
would be a solution, but I can't connect it with another command.
or this one:
for i in `find $1 type -d'
do
for j in `find $i type -f -size +(size($i))` // in blocks
do
echo j;
done
done
where, size($i) would be the size converted in blocks, and I didn't know how to do that.
Thanks