Deleting all empty files in sub directories with a command

Hello Friends,

Im trying to delete empty files in subdirectories with a command. I can find them checking only one directory in each step and then show them with my command like below moreover i could not add removing part:

ls -l */* | awk '{if ($5==0) printf "%3s %2d %s %15d\n",$6,$7,$9,$5}'

as a result this command is not working as i like, can u suggest a better one?

Try the find command with the -empty option:

find . -empty -exec rm -f {} \;

Thanks Franklin, it gave bad option warning for -empty. However cant i display the empty files before or after they are removed, like the above AWK command?

server1{root}/acb>find . -empty -exec rm -f {} \;
find: bad option -empty

Your find version doesn't support the -empty option, try this one:

find . -size 0c -exec rm -f {} \;

Ok thanks,it works well. I have added "-print" option so that i can see what i delete:

server1{root}/>

find . -size 0c -print -exec rm -f {} \;

./aaaa.txt

You can also use verbose option of rm command as,

find . -size 0c -exec rm -vf {} \;
removed `./t'