How to do recursive file delete using specifier (*.tmp) from nested directories?
Linux - GeneralThis forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Dear all,
I have a similar problem with deleting some files recursively but more complex and I have not yet found a solution if anyone here can help me.
So my problem is this :
Suppose I have a root folder named 'vantoora' and have many subfolders inside 'eg. vantoora1, vantoora2... vantooraN'.
Inside of each subfolders there are two folders named 'new' and 'old' which contain many files each.
vantoora
|_ vantoora1
|_ new
|_ file1.txt
|_ old
|_ file1.txt
|_ file2.txt
|_ vantoora2
|_ new
|_ file1.txt
|_ file2.txt
|_ old
|_ file2.txt
:...
:...
|_ vantooraN
|_ new
|_ file1.txt
|_ file2.txt
|_ old
|_ file1.txt
|_ file2.txt
What I want to do is that search recursively for 'new' and/or 'old' and then delete every files inside those folders.
$ cd vantoora
$ vantoora > ls
$ vantoora > vantoora1 vantoora2 ... vantooraN
What I have done is following command but don't want to delete :
$ find -name 'new' | xargs ls "$1" /* to list all files inside all new folder */
tried :
$ find -name 'new' | xargs ls "$1" | xargs rm -f
but returned error something like : ls: cannot access ./vantoora/vantoora1...
All suggestions are welcome.
Thanks for you reply.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
Advertisement
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Click Here to receive a complimentary subscription courtesy of LQ.