Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-25-2009, 08:09 PM   #1
Registered: Dec 2004
Location: Sydney, AU
Distribution: CentOS 5.x, Backtrack
Posts: 72

Rep: Reputation: 16
Question Removing program diretories and files with a bash script

I have a large number of PCs which have a program installed that I need to remove. The program was compiled and installed from source but the source directory was removed so I can't do a make uninstall.

I want to create a bash script that basically does a

# locate programname

and then rm -f any file or directory it returns. I know this is a little dangerous as locate might return a non-related file but I've tested on a few machines and so far it has only returned files related to my program.

Does anyone know how to accomplish this with a bash script or have ideas of a better way?


Old 05-25-2009, 08:55 PM   #2
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
As per the caveat you mentioned ;}

rm -rf $( dirname $( locate programname ) )



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
Trouble with making a bash script to read in different files and rename output files. rystke Linux - Software 1 05-07-2009 08:00 AM
script for removing 30day old files but keeping *.zip timnewton Red Hat 7 10-14-2008 03:50 AM
removing # from crontab (bash script) inderpunj Programming 4 10-13-2008 02:34 PM
bash script to rename files removing one character Byenary Linux - Newbie 2 04-08-2008 10:12 AM
To rename files in a directory should I use Bash script or a Perl Script ? jamtech Programming 7 01-22-2008 11:25 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:18 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration