Solved

remove files recursively

Posted on 1998-07-03
1
232 Views
Last Modified: 2010-05-18
I ever asked questions about find files recursively and rename a set of  files in current directory.
the following command , which can remove files with extension .a recursively,  is based on the answers.

 find pathname -type f -name "*.a" | sed -e 's/\(.*\)\.a/rm \1.a/' |sh

I feel I make it complicated. Is there other way to do it?
Thanks
0
Comment
Question by:tian
1 Comment
 
LVL 5

Accepted Solution

by:
ecw earned 0 total points
ID: 2008444
The safest
 find pathname -type f -name "*.a" -exec rm '{}' \;
or quicker, but not as safe
  find pathname -type f -name "*.a" | xargs rm
or if total length of all filenames will not execeed ARG_MAX
 rm `find pathname -type f -name "*.a"`

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question