Solved

remove files recursively

Posted on 1998-07-03
1
227 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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now