LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Delete a subfolder ABC from main Project Folder (http://www.linuxquestions.org/questions/linux-newbie-8/delete-a-subfolder-abc-from-main-project-folder-894408/)

adarshmca 07-29-2011 12:22 AM

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

chrism01 07-29-2011 01:09 AM

Start by reading up on 'find' http://linux.die.net/man/1/find

jv2112 07-30-2011 05:11 PM

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.

T3RM1NVT0R 07-30-2011 05:21 PM

@ 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.

adarshmca 07-31-2011 11:52 PM

Thanks


All times are GMT -5. The time now is 05:56 PM.