Server Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bama
    Confirmed User
    • Nov 2001
    • 2727

    #1

    Server Question

    I am soooo not a server guy but I need to get a list of any/all .php files on my server. There are lots of sub-directories and the pages on the server are not linked together.

    Anyone have a php script that can do this? I don't want to have to exclude any files or folders by hand (excludes off the shelf solutions) and the print-out needs to write out the full url for me (such as)

    http://www.domain.com/foo/foo1/foo.php
    http://www.domain.com/foo2/foo1/foo/foo2.php

    and not just foo.php and foo2.php

    There's probably a simple /find *.php |grep all -print dummydoesntknowunix.txt command i could use too - so that would work as well

    Help is appreciated!
  • munki
    Do Fun Shit.
    • Dec 2004
    • 13393

    #2
    checkout googles python site map script... i've used it to scrap active pages a couple of times

    I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde

    Comment

    • skrinkladoo
      Confirmed User
      • Oct 2007
      • 629

      #3
      maybe start simple via ssh

      locate .php

      or use a wildcard for the search.
      I'am sure there are prettier ways ... my ssh is rusty, been spoiled w/ developers and admins for long time.
      *** Andrew Love ***

      Services: (1) Web Design, (2) Graphic Design, (3) E-commerce, (4) Database Development,
      (5) Web Analytics, (6) Targeted Lead Generation, (7) Marketing and Consulting

      Mainstream: Successful Website Landing Page Design | ICQ: 360-83-9627

      Comment

      • netpimp
        Registered User
        • Jan 2005
        • 66

        #4
        find / -name "*.php" -print > /tmp/phpfilelist.txt

        or

        find / -name "*.php" -print | more


        locate would work above too, provided your locate database update script has ran, which is usually a middle of the night type of cronjob.

        Comment

        • sortie
          Confirmed User
          • Mar 2007
          • 7771

          #5
          Originally posted by Bama
          I am soooo not a server guy but I need to get a list of any/all .php files on my server. There are lots of sub-directories and the pages on the server are not linked together.

          Anyone have a php script that can do this? I don't want to have to exclude any files or folders by hand (excludes off the shelf solutions) and the print-out needs to write out the full url for me (such as)

          http://www.domain.com/foo/foo1/foo.php
          http://www.domain.com/foo2/foo1/foo/foo2.php

          and not just foo.php and foo2.php

          There's probably a simple /find *.php |grep all -print dummydoesntknowunix.txt command i could use too - so that would work as well

          Help is appreciated!
          Where are you hosted?

          Comment

          • PR|Jordan
            Confirmed User
            • Oct 2008
            • 244

            #6
            Ok, I am really not a tech - however, here is something i put together, remember to updatedb first.

            Some edits will have to be done for you case
            locate *.php | sed 's/\/var\/www\/html/www.domain.com/'

            or do

            locate *.php | sed 's/\/var\/www\/html/www.domain.com/' >> file.txt
            I really wanted to use a recursive LS but couldn't figure out a way to save my life to pull from ls -RD lol
            Jordan Jacobs - OC3 Networks / Pacific Rack - ICQ:1408 1732 - jjacobs[@]pacificrack.com
            These deals ROCK!
            Dual Core E2180, 2GB DDR2, 250GB SATA-2, 2000GB - $89 /month
            Quad Core Q9300, 2GB DDR2, 250GB SATA-2, 2000GB - $129 /month

            Comment

            • PR|Jordan
              Confirmed User
              • Oct 2008
              • 244

              #7
              did that work for you?
              Jordan Jacobs - OC3 Networks / Pacific Rack - ICQ:1408 1732 - jjacobs[@]pacificrack.com
              These deals ROCK!
              Dual Core E2180, 2GB DDR2, 250GB SATA-2, 2000GB - $89 /month
              Quad Core Q9300, 2GB DDR2, 250GB SATA-2, 2000GB - $129 /month

              Comment

              • million
                Confirmed User
                • Apr 2006
                • 789

                #8
                Originally posted by netpimp
                find / -name "*.php" -print > /tmp/phpfilelist.txt

                or

                find / -name "*.php" -print | more


                locate would work above too, provided your locate database update script has ran, which is usually a middle of the night type of cronjob.
                The binary is called "updatedb". It updates the slocate database, which the binary "locate" uses later.
                <sig spot goes here>

                Comment

                • PR|Jordan
                  Confirmed User
                  • Oct 2008
                  • 244

                  #9
                  Originally posted by netpimp
                  find / -name "*.php" -print > /tmp/phpfilelist.txt

                  or

                  find / -name "*.php" -print | more


                  locate would work above too, provided your locate database update script has ran, which is usually a middle of the night type of cronjob.
                  This would just give him the file locations not the list like he was needing - gotta use a sed in there.
                  Jordan Jacobs - OC3 Networks / Pacific Rack - ICQ:1408 1732 - jjacobs[@]pacificrack.com
                  These deals ROCK!
                  Dual Core E2180, 2GB DDR2, 250GB SATA-2, 2000GB - $89 /month
                  Quad Core Q9300, 2GB DDR2, 250GB SATA-2, 2000GB - $129 /month

                  Comment

                  • Bama
                    Confirmed User
                    • Nov 2001
                    • 2727

                    #10
                    Actually, tech support over at YellowFiber did it for me!

                    find / -name '*.php' > list.txt

                    This gave me the list as /user/home/domain.com/foo/foo.php then I did a search/replace /user/home/ with http:// and that gave me the list in the format I needed

                    Comment

                    • PR|Jordan
                      Confirmed User
                      • Oct 2008
                      • 244

                      #11
                      But it doesnt look as cool as:

                      locate *.php | sed 's/\/var\/www\/html/www.domain.com/' >> file.txt

                      But i am glad you got it working
                      Jordan Jacobs - OC3 Networks / Pacific Rack - ICQ:1408 1732 - jjacobs[@]pacificrack.com
                      These deals ROCK!
                      Dual Core E2180, 2GB DDR2, 250GB SATA-2, 2000GB - $89 /month
                      Quad Core Q9300, 2GB DDR2, 250GB SATA-2, 2000GB - $129 /month

                      Comment

                      • Bama
                        Confirmed User
                        • Nov 2001
                        • 2727

                        #12
                        Thanks for the suggestions tho - very much appreciated

                        Comment

                        Working...