Re: How to remove all files with a certain extension
On Apr 6, 2009, at 5:11 PM, Dan Nelson wrote: In the last episode (Apr 06), John Almberg said: This is a real newbie question, but I can't figure it out... I want to remove all .tar files from a directory tree. I think something like the following should work, but I must have something wrong, because it doesn't: find . -name *.tar -exec rm /dev/null {} \; find . -name "*.tar" -delete Make sure you quote your wildcards so the shell doesn't expand them, and use the -delete primary to save a fork/exec for each filename. Fantastic. I never noticed the -delete option before. Amazing what you can find in a man page if you know it's there :-) Thanks: John ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: How to remove all files with a certain extension
In the last episode (Apr 06), John Almberg said: > This is a real newbie question, but I can't figure it out... > > I want to remove all .tar files from a directory tree. I think something > like the following should work, but I must have something wrong, because > it doesn't: > > find . -name *.tar -exec rm /dev/null {} \; find . -name "*.tar" -delete Make sure you quote your wildcards so the shell doesn't expand them, and use the -delete primary to save a fork/exec for each filename. -- Dan Nelson dnel...@allantgroup.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: How to remove all files with a certain extension
On Mon, 2009-04-06 at 16:57 -0400, John Almberg wrote: > This is a real newbie question, but I can't figure it out... > > I want to remove all .tar files from a directory tree. I think > something like the following should work, but I must have something > wrong, because it doesn't: > > find . -name *.tar -exec rm /dev/null {} \; > find . -type f -name "*.tar" -delete > What am I doing wrong? > > Thanks: John > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org" -- Julien Cigar Belgian Biodiversity Platform http://www.biodiversity.be Université Libre de Bruxelles (ULB) Campus de la Plaine CP 257 Bâtiment NO, Bureau 4 N4 115C (Niveau 4) Boulevard du Triomphe, entrée ULB 2 B-1050 Bruxelles Mail: jci...@ulb.ac.be @biobel: http://biobel.biodiversity.be/person/show/471 Tel : 02 650 57 52 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: How to remove all files with a certain extension
On Mon, 6 Apr 2009 16:57:39 -0400, John Almberg wrote: JA> This is a real newbie question, but I can't figure it out... JA> JA> I want to remove all .tar files from a directory tree. I think JA> something like the following should work, but I must have something JA> wrong, because it doesn't: JA> JA> find . -name *.tar -exec rm /dev/null {} \; find . -type f -name '*.tar' -delete -- Anton Yuzhaninov ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: How to remove all files with a certain extension
On Apr 6, 2009, at 4:57 PM, John Almberg wrote: This is a real newbie question, but I can't figure it out... I want to remove all .tar files from a directory tree. I think something like the following should work, but I must have something wrong, because it doesn't: find . -name *.tar -exec rm /dev/null {} \; What am I doing wrong? Oh, duh... that /dev/null shouldn't be there. -- John ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
How to remove all files with a certain extension
This is a real newbie question, but I can't figure it out... I want to remove all .tar files from a directory tree. I think something like the following should work, but I must have something wrong, because it doesn't: find . -name *.tar -exec rm /dev/null {} \; What am I doing wrong? Thanks: John ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"