Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux 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.


  Search this Thread
Old 12-03-2013, 06:03 AM   #1
Registered: Oct 2013
Posts: 434

Rep: Reputation: Disabled
find command and multiple * usage

Please can i use:

find /home/username/public_html/_sub/*/wp-content/*cache* -type f -delete

command to empty all folders contianing "cache" in wp-content directory.

issue is that in /home/username/public_html/_sub/
i have around 50 folders and i want to use this rule on all of them, so im using *.

im asking there because im afraid could delete whole /_sub contents or similar horror story

i just want to empty folders containing cache in that wp-content directories

i cant say it my english is bad

is above command safe?
Old 12-03-2013, 06:19 AM   #2
Registered: Feb 2006
Posts: 47

Rep: Reputation: 29
You could always check it by printing what files are found (and hence what would be deleted):

find /home/username/public_html/_sub/*/wp-content/*cache* -type f -print
1 members found this post helpful.
Old 12-03-2013, 04:54 PM   #3
Senior Member
Registered: Apr 2010
Posts: 1,311

Rep: Reputation: 223Reputation: 223Reputation: 223
you can check this one, you can use cp or mv to make sure there is no disaster rather than deletion

find . -type f -name "some*.fil" -exec cp -iv {} /destination/folder \;
# or less likely...
find . -type f -name "some*.fil" -print0 | xargs -J % cp -iv /destination %

got that from this link:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 04:45 PM
Using a single "Find" Command to find files bases on multiple criteria roboxooo Linux - Newbie 6 01-15-2009 04:13 AM
how to find max memory usage for process in Linux by command line kashameni Linux - Newbie 9 06-01-2007 01:39 AM
Other than top command which cmd is used to find the cpu usage and disk space sathish80 Linux - Newbie 2 11-15-2006 12:43 AM
find command - multiple direcories ygloo Linux - General 3 08-25-2006 04:44 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration