LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-03-2013, 06:03 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

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
bonnydeal
Member
 
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):

Code:
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
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,150

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
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: http://www.daemonforums.org/showthread.php?t=6029
 
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:10 AM.

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