Or how about find . -empty -maxdepth 1 -delete
On Tue, Jul 28, 2009 at 5:35 PM, Jameson Williams < [email protected]> wrote: > On Tue, Jul 28, 2009 at 5:14 PM, Andrew Brookins > <[email protected]>wrote: > >> Hey, list, >> >> This is kind of a pedestrian request, but hey, it's like 104 degrees >> outside. >> >> I wanted to remove all empty files in a directory today, so I typed >> this command: >> >> ls -s | grep -e '^ 0' | sed 's/^...//' | xargs -n1 rm -v >> >> Then I was like, WTF, three pipes? And I wondered how many variations >> on this kind of thing there were. There's also this one, which I just >> pulled from http://www.linux.ie/newusers/beginners-linux-guide/find.php: >> >> find . -empty -maxdepth 1 -exec rm {} \; >> >> But maybe you have a better one? Or if not, maybe you can share your >> favorite one-liner? >> >> Andrew >> _______________________________________________ >> PLUG mailing list >> [email protected] >> http://lists.pdxlinux.org/mailman/listinfo/plug >> > > Andrew, I like your find command -- that's the most concise I can think of. > find, ssh, xargs, and the bash <<< redirect are all good for making concise > and powerful one-liners. > > Here's another version of yours, though doesn't hit the hidden stuff: > > find * -prune -empty -exec rm {}\; > > > _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
