The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

search for files & remove it from the server

Discussion in 'General Discussion' started by crazyaboutlinux, Oct 25, 2011.

  1. crazyaboutlinux

    crazyaboutlinux Well-Known Member

    Joined:
    Nov 3, 2007
    Messages:
    938
    Likes Received:
    0
    Trophy Points:
    16
    Hi,

    i need a command which search for a file "indexxx.php" in the /home/*/public_html/* (directory & its all sub directories) & remove them from the server
     
  2. Chris.Bshm

    Chris.Bshm Member

    Joined:
    Oct 20, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    This for loop should work for you. If 'xx' is a variable, just replace it with an aesteric (*)

    for i in `find /home/*/public_html/ -iname 'indexxx.php'`; do rm -rfv $i; done


    Hope this helps.
     
Loading...

Share This Page