LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-29-2011, 01:22 AM   #1
adarshmca
LQ Newbie
 
Registered: Dec 2010
Posts: 28

Rep: Reputation: 0
Delete a subfolder ABC from main Project Folder


Dear all,

I want to delete a subfolder ABC in a main Project folder Globe.
It occurs in many subfolders.

It is very hectic to search and issue an rm -rf ABC command.

I need to make a script for that .

Can anyone tell me how to make this


Thanks
 
Old 07-29-2011, 02:09 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
Start by reading up on 'find' http://linux.die.net/man/1/find
 
Old 07-30-2011, 06:11 PM   #3
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 718

Rep: Reputation: 102Reputation: 102
Lightbulb

find /path to parent/folder/ -type d -and -iname Folder-Name -exec stat {} \;


Validate they are the correct folders. Then change stat to rm -fr.
 
Old 07-30-2011, 06:21 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

Hi there,

You can also try the following commands:

Code:
find / -name name_of_the_folder -print
The above command will print the location where that folder ABC has been created

you can delete the folder with the same command but with little modification:

Code:
find / -name name_of_the_folder -print -delete
I hope this helps.
 
1 members found this post helpful.
Old 08-01-2011, 12:52 AM   #5
adarshmca
LQ Newbie
 
Registered: Dec 2010
Posts: 28

Original Poster
Rep: Reputation: 0
Thanks
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show folder and only one subfolder using ls in command line Drigo Linux - Newbie 4 07-14-2011 01:56 PM
Compare string (capitol letters) abc to ABC Willy Fog Linux - Newbie 4 09-17-2009 12:36 PM
How to set linux environment variable like abc.abc (With DOT in the string) super_hill Linux - General 1 12-03-2008 08:37 PM
how to run a script on subfolder file in a folder saggi_sam Linux - Newbie 5 07-13-2005 06:04 AM
main.c vs project.c liguorir Programming 6 05-24-2004 08:49 AM


All times are GMT -5. The time now is 04:30 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration