Yeah, I like yours. The find command is probably best. I feel like my three-pipe solution is the beginning of a Daily WTF article. Like, here's how I sorted my ls output by size... with seven pipes and 467 characters!
There's nothing like a good one-liner... except maybe a solid regex. Andrew On Wed, Jul 29, 2009 at 12:37 AM, Jameson Williams<[email protected]> wrote: > 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 > _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
