In my main_dir, I have a lot of sub-folders say DFT1 to DFT150, and in each directory, there is a file named OSZICAR. However, some of this would have file size 0.
So I would like to have a script, that goes into each folder and checks the size of OSZICAR, if it is below size of 10 bytes, then delete its DFT folder.
The pseudo-code (which doesn't work), I have is:
for f in *; do
cd $f
status=(check whether OZICAR has size below 10bytes)
cd ..
if (status); do
rm -r $f
fi
done
if [ ! -s file ] ; then. Citingman bash: " -s file True if file exists and has a size greater than zero." I.e.-s= look for non-empty files.