Solved

remove files recursively

Posted on 1998-07-03
1
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

615 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