Solved

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

Posted on 2006-07-24
1
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
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.

739 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