LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to Delete? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-delete-279769/)

Crimson Star 01-19-2005 01:26 PM

How to Delete?
 
Is there anyway in Linux to delete wildcard files in multiple subdirectories? Say I'm in DirectoryA which has SubdirectoryA and SubdirectoryB. In each of these subdirectories there are various files. How would I go about deleting, say, all files that start with the letter 'a' without having to issue separate rm -r a* for each subdirectory?
Thanks.

druuna 01-19-2005 01:33 PM

Hi,

Here's one way:

find . -type f -name "a*" -exec ls {} \;

If this wokrs for you change the ls to rm, the ls is there for testing the a*.

See man find and online docs for details of the find command. Do be carefull with the -exec rm command. Test first!!

Hope this helps.


All times are GMT -5. The time now is 09:22 PM.