FIND and REMOVE HELP NEEDED!!!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers FIND and REMOVE HELP NEEDED!!!
# 1  
Old 09-18-2006
FIND and REMOVE HELP NEEDED!!!

Hello,

I am aware of that Find command finds certain files and remove command removes certain files.

However, is there a way to Find certain DIRECTORY and remove that DIRECTORY?

thank you
# 2  
Old 09-18-2006
Code:
find / -type d -name <dirname> -exec rm -rf {} \;

Where <dirname> is the directory name or patern.

Very dangerous!!! Smilie

Regards.
# 3  
Old 09-18-2006
thanks for the code. however, when i run it, it says
" find: bad option -rf "

am i doing something wrong? this is what i have

find / -type d -name <TestFolder> -exec rm -rf {} \;

thank you
# 4  
Old 09-19-2006
Quote:
Originally Posted by scooter17
thanks for the code. however, when i run it, it says
" find: bad option -rf "

am i doing something wrong? this is what i have

find / -type d -name <TestFolder> -exec rm -rf {} \;

thank you
Seems to be OK, but try:

Code:
find / -type d -name  <TestFolder> -exec rm \-rf {} \;

Notice the "\" back slash.

(-rf are "rm" parameters: recursive and force)

Regards.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash to remove find and remove specific extension

The bash below executes and does find all the .bam files in each R_2019 folder. However set -x shows that the .bam extension only gets removed from one .bam file in each folder (appears to be the last in each). Why is it not removing the extension from each (this is $SAMPLE)? Thank you :). set... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. UNIX for Dummies Questions & Answers

help needed: remove space between certain columns

dear all, i have a data looks like this (i have 3000 columns): rs123 A T T G C C C C C C A A A A A A A A A A A ... rs154 T T G C C C C C A A A A A A A A A A T T G ... rs126 A C C C C C A A A A A A A A A A A A T T G ... I want to remove all the space after the 2nd column and make the... (2 Replies)
Discussion started by: forevertl
2 Replies

3. Shell Programming and Scripting

shell command to remove some XML tag is needed

Hi all, I have a file which i have to remove some line from it, the lines that i have to remove from my file is as below: </new_name></w"s" langue="Fr-fr" version="1.0" encoding="UTF-8" ?> <New_name> and it is finding at the middle of my file, is there any command line in linux to do it or do... (10 Replies)
Discussion started by: id_2pc
10 Replies

4. UNIX for Dummies Questions & Answers

Remove Permission Help needed.

How would i remove rwx permission for group and other users for all hidden files (except . and ..) inside /root using a one line command. I have tried below command. # chmod og-rwx /root/.* but this has removed rwx permission for . and .. files . As a result # ls -ld /root drwx------ 3... (4 Replies)
Discussion started by: pinga123
4 Replies

5. Shell Programming and Scripting

Help needed to remove a char from a specified sub-string

Hi! I'm having trouble usind sed to remove the char ' from within a database's varchar register's sql. For example, on the following sql: INSERT INTO patrimonio_municipal.patrimonio_municipal_airc_tmp Values('|Estação Elevatória|',|16723|,'|Grandes Reparações|', '|2010-03-26... (3 Replies)
Discussion started by: cremat0rio
3 Replies

6. UNIX for Dummies Questions & Answers

Help needed with find command

Hi Guys, Can someone help with this. I have to find out a file name which calls the following sql script "abhishek_to_sdw.sql". In other words it contains a pattern like "abhishek_to_sdw.sql". I have found out using "find" command that the file abhishek_to_sdw.sql is existing on the... (4 Replies)
Discussion started by: max29583
4 Replies

7. Shell Programming and Scripting

please help me how to script atomatic remove file that are not needed

Im new to this forum and also Unix. I need help to solve this Directory Clean-up. Im not sure how to do but i wish someone could help me out. I have to develop a script that can be used to automatically remove files that are not needed. The final script will be developed in two iterations. The... (1 Reply)
Discussion started by: sunilnbalar
1 Replies

8. Shell Programming and Scripting

find explantion needed

Dear Experts, please can any body help me to explain the below commants in detail what exactly its doing what we mean by -mtime +2 and -exec and rm{}; find /home/data/ab.200* -mtime +2 -exec rm {} \; Regards, SHARY (3 Replies)
Discussion started by: shary
3 Replies

9. UNIX for Dummies Questions & Answers

Find and Remove help needed!!!!

thank you for the help. (1 Reply)
Discussion started by: scooter17
1 Replies

10. Shell Programming and Scripting

Remove a File - Help Needed

Hi, I have created a file "-f.txt" or "-f" and now i want to remove this file, I have tried rm -f -f, but you would have understood the problem i am facing. Now please let me know what needs to be done, Also one more question i want to know the difference between Hard Link and Soft Link and... (3 Replies)
Discussion started by: amitkhiare
3 Replies
Login or Register to Ask a Question