Solved

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

Posted on 2006-07-24
1
256 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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

632 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