Find command and multiple * usage


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find command and multiple * usage
# 1  
Old 12-03-2013
Find command and multiple * usage

Please can i use:

Code:
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?
# 2  
Old 12-03-2013
The shell will replace the wildcards with all matching directory names which might result in a - maybe too - lengthy command line. Don't delete in the first run - have the results listed and check. If you're happy, delete.
# 3  
Old 12-03-2013
so instead of operation "delete", i will do operation "print" in "find" command

-delete
-print
# 4  
Old 12-03-2013
Yes. -print is the default if no other action is defined. Try to set -vx options to analyze what the shell expands your parameters to.
This User Gave Thanks to RudiC For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Usage of find command

I need to find a file that has been modified in last 3-4 hours. mtime tells us about file modified in n days. Is there any way I can check for hours or minutes file modified or created before. (5 Replies)
Discussion started by: ankush_mehra
5 Replies

2. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

3. UNIX for Dummies Questions & Answers

grep command to find multiple strings in multiple lines in a file.

I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. I am writing it another way to make it clear, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies

4. UNIX for Dummies Questions & Answers

Command to display the space usage (memory usage) of a specific directory.

Hi all, Can you please tell me the command, with which one can know the amount of space a specific directory has used. df -k . ---> Displays, the amount of space allocated, and used for a directory. du -k <dir name> - gives me the memory used of all the files inside <dir> But i... (2 Replies)
Discussion started by: abhisheksunkari
2 Replies

5. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

6. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

7. UNIX for Dummies Questions & Answers

Disk Usage in GB and Unix command to find the biggest file/folder

Hi All, Please help me out 1) Command to find the disk usage in GB. I know that du -k will give in kilobites. 2) How to find the Biggest file/folder in a given set of files/folders. Thanks in advance Regards, Manas (8 Replies)
Discussion started by: manas6
8 Replies

8. AIX

command usage on find with xargs and tar

my task : tar up large bunch of files(about 10,000 files) in the current directories that created more than 30 days ago but it come with following error find ./ -ctime +30 | xargs tar rvf test1.tar tar: test1.tar: A file or directory in the path name does not exist. (3 Replies)
Discussion started by: darkrainbow
3 Replies

9. Solaris

Usage find command

is there any way to search the file using find command, so that it searches for the file considering the file name as case in-sensitive For example file name is AbcD.txt but i'm not sure of the file name just remember it was abcd.txt find / -name "abcd.txt" -print how do we go bout the... (2 Replies)
Discussion started by: raman1605
2 Replies

10. UNIX for Advanced & Expert Users

find command usage

I usually ise find to search a file or name on the unix, since I am not administrator, there will be many line appear 'cannot access',usually a hundred of lines. How can I prevent this line coming out? only show I want? The command I use is : find / -name abcdef -print Thank all expert. (1 Reply)
Discussion started by: zp523444
1 Replies
Login or Register to Ask a Question