Solved

remove files recursively

Posted on 1998-07-03
1
228 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
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…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

770 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