what i do wrong, find grep rm, help me plz


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting what i do wrong, find grep rm, help me plz
# 1  
Old 04-28-2008
what i do wrong, find grep rm, help me plz

hello.
i need find folders only with name 2006 and delete.

find /path/to/dir/-07/ -type d | grep 2006 | -exec rm -rf {} \;

and etc doesnt work :\
what i do wrong :?
# 2  
Old 04-28-2008
Quote:
Originally Posted by djdes22
hello.
i need find folders only with name 2006 and delete.

find /path/to/dir/-07/ -type d | grep 2006 | -exec rm -rf {} \;

and etc doesnt work :\
what i do wrong :?
Why you need grep ? Read man find
Code:
find /path/to/dir/-07/ -type d -name "2006"  -exec rm -rf {} \;

# 3  
Old 04-28-2008
Quote:
Originally Posted by danmero
Why you need grep ? Read man find
Code:
find /path/to/dir/-07/ -type d -name "2006"  -exec rm -rf {} \;

doesnt workSmilie not deleted.

root@des:/media/2008-04-26/des# ls
Deepslauter-Rock_Em_All-(Reissue)-2007-VERiTAS Enjae-Enjae-2006-SMO

root@des:/media/2008-04-26/des# find /media/2008-04-26/des/ -type d -name "2006" -exec rm -rf {} \;

root@des:/media/2008-04-26/des# ls
Deepslauter-Rock_Em_All-(Reissue)-2007-VERiTAS Enjae-Enjae-2006-SMO

Last edited by djdes22; 04-28-2008 at 12:26 PM..
# 4  
Old 04-28-2008
find /path/to/dir/-07/ -type d -name "*2006*" -exec rm -rf {} \;
# 5  
Old 04-28-2008
Quote:
Originally Posted by redhead
find /path/to/dir/-07/ -type d -name "*2006*" -exec rm -rf {} \;
ohh working! BIG thx all
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what's wrong with my regex using find

#ls json-* json-lexer.c json-lexer.h json-parser.c json-parser.h json-streamer.c json-streamer.h #find . -regex '^(json-)+.' return nothing (3 Replies)
Discussion started by: yanglei_fage
3 Replies

2. Shell Programming and Scripting

what's wrong with my -exec in find

find ./ -name *Kconfig -exec cat {} \; but it won't work with find ./ -name *Kconfig -exec cat {} |grep CONFIG_MTD |grep depend \; how could I handle this (14 Replies)
Discussion started by: yanglei_fage
14 Replies

3. Shell Programming and Scripting

Need some Help for file filteration and saving the output in other directory using grep....plz ...

Hi all........ Plss do help me.......in a big trouble... :wall::wall::wall: I have 3 directories named as :1. /home/shuchi/source 2./home/shuchi/destination 3./home/shuchi/filter now the problem is /home/shuchi/source has say 2 files with extension .txt as given below : A.txt Code: ... (0 Replies)
Discussion started by: ektubbe
0 Replies

4. Shell Programming and Scripting

Grep command showing wrong output in Linux

Hi All I am trying to run a script in linux wherein i have a command like this grep ^prmAttunityUser= djpHewr2XFMAttunitySetup_ae1_tmp djpHewr2XFMAttunitySetup_ae1_tmp is a temporary file in which the user value is stored but this command in the script returns me balnk value whereas it has a... (4 Replies)
Discussion started by: vee_789
4 Replies

5. UNIX for Advanced & Expert Users

what is wrong with this find command

i am trying to find the files which are more than 100MB and it was created 10 days ago. find /lola/loaded -size +102400 -mtime -10 -print | xargs ls -ltr -rw-rw-r-- 1 lola_adm gdrmp 82054170 Jun 23 06:17 /lola/loaded/ILMEMBER20090622.txt -rw-rw-r-- 1 lola_adm gdrmp 652080494 Jun 24... (3 Replies)
Discussion started by: sudhiroracle
3 Replies

6. Linux

Plz Help me to find GNU C++ Runtime Library

Hi, I am working with red hat Linux and i want to install one program but I am getting the error This product requires the GNU C++ Runtime Library (libstdc++-libc6.2-2.so.3) or later. Your system must be upgraded before installation can proceed. So please tell me how can i remove this... (2 Replies)
Discussion started by: smartgupta
2 Replies

7. Shell Programming and Scripting

Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!!

hi all, I need to find out the last 2 modified files in a folder.There is some way by which,we can check the timestamp and find out..??please help this is urgent. Thanks in Advance Anju (3 Replies)
Discussion started by: anju
3 Replies

8. UNIX for Dummies Questions & Answers

what is wrong in this awk or grep ....

hi champs, i have a strange problem, let , i have a array1, whose 1st character is ${array1}=h let i want to search test.txt by awk/grep where the 1st character is the ${array1}.... if i am seraching by awk/grep by using variable..it return no rows from test.txt... awk -v find=${array1}... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

9. UNIX for Dummies Questions & Answers

find command - Urgent Plz.

Hi, In my current directory, i have the following files: x1.dat x2.dat.gz x3.dat I want to use the find command and display only files which has *.dat and NOT *.gz extension files. Please help me out. Thanks, Kris Kart. (2 Replies)
Discussion started by: Kris_Kart_101
2 Replies

10. UNIX for Dummies Questions & Answers

plz Help How should I configure cc compiler output file plz help???

i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
Login or Register to Ask a Question