Solved

Deleting the same named file located in multiple directories in a LAMP Server

Posted on 2006-07-24
1
251 Views
Last Modified: 2010-04-20
Good Afternoon,

I have a single file that shows up in multiple subdirectories off of the home directory on a LAMP server. The file is called wedo.php. There are possibly 300 of them in various directories under home and I need to delete them all. Is there a way to do a mass located and then a mass delete?

I am in a bit of hurry for this so any help you can give would be appreciated.

0
Comment
Question by:safepointmedia
1 Comment
 
LVL 22

Accepted Solution

by:
pjedmond earned 500 total points
ID: 17170113
******STOP*******

I forgot to change the file name!!!! Obviously make a backup before doing!

Correct scripts are:


find /var/www/ | grep "wedo\.php$" | awk {'print "rm " $1 '} | /bin/bash

Will do it.

To test without running the command:

find /var/www/ | grep "wedo\.php$" | awk {'print "rm " $1 '}

(   (()
(`-' _\
 ''  ''

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now