Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2005
    Location
    West Sussex,
    Posts
    57

    checking for mp3's/avi's

    hello,

    is there any form of a script i can install that checks my clients files for things like mp3's/avi's/.exe's?
    Luke Bailey
    Wittering PC
    www.witteringpc.co.uk

  2. #2
    Join Date
    Mar 2004
    Location
    Duluth, MN
    Posts
    286

    Re: checking for mp3's/avi's

    Originally posted by twmonline
    hello,

    is there any form of a script i can install that checks my clients files for things like mp3's/avi's/.exe's?
    Here's a simple bash script which should do the trick

    Code:
    #! /bin/bash
    
        locate *.exe
    
        locate *.mp3
    
        locate *.avi
    Just save it as locate.sh and set a cron to run it as desired and mail the results to you. Make sure to chmod +x to make it executable.

    Tim
    Tim Ryberg, InterWorx L.L.C. | InterWorx Hosting Control Panel 3.0!
    Views expressed are the author's own and do not represent those of InterWorx L.L.C. unless stated otherwise.
    Join me in my personal quest for The Ultimate CMS!

  3. #3
    Join Date
    Oct 2004
    Location
    India
    Posts
    491
    #! /bin/bash

    locate *.exe

    locate *.mp3

    locate *.avi
    It will do the search for the mp3, exe, avi .

    Before running this manually or through the cron dont forget to run the updatedb &. It will update the slocatedatabase so that you get latest results.
    Last edited by firestarter; 07-04-2005 at 09:15 AM.
    ESC :wq!

  4. #4
    Join Date
    Apr 2002
    Location
    Philadelphia
    Posts
    2,277

    Re: checking for mp3's/avi's

    Originally posted by twmonline
    hello,

    is there any form of a script i can install that checks my clients files for things like mp3's/avi's/.exe's?
    It depends if you have SSH access enabled or not. If you don't have SSH access there is really nothing that you can do but if you do have SSH you can use some type of bash script like above.

  5. #5
    Join Date
    Mar 2004
    Location
    Duluth, MN
    Posts
    286
    some control panels will let you run crontabs as root/psudo root from the control panel.

    Just add updatedb to the beginning of the script above.
    Tim Ryberg, InterWorx L.L.C. | InterWorx Hosting Control Panel 3.0!
    Views expressed are the author's own and do not represent those of InterWorx L.L.C. unless stated otherwise.
    Join me in my personal quest for The Ultimate CMS!

  6. #6
    Join Date
    Jan 2004
    Location
    <<Canada>>
    Posts
    734
    thx TranswarpHos and firestarter.

    I never know that.
    <<< Please see Forum Guidelines for signature setup. >>>

  7. #7
    Join Date
    Mar 2004
    Location
    Duluth, MN
    Posts
    286
    I just takjed to my friend Socheat and did some digging and voila

    Code:
    #! /bin/bash
    
    # This script is designed to locate certain types of files 
    # on a linux server, for example the media files shown below.
    
    # It can be run manually from the shell ./locate.sh or from a 
    # cron. Make sure to chmod +x locate.sh to make it executable.
    
    # It is strongly recommended that you update the slocatedatabase 
    # to get the best results. This is a very processor intensive 
    # command so it's best if you nice it so that it does
    # not eat up all of your boxes resources.
    
    # Priority for this command is set on -n attrubute from -20 
    # (the highest priority) to 19 (the lowest priority). Not listing 
    # the -n is the same as 0 and listing the -n without 
    # a number is the same as -n 10. Change as you see fit.
    
    nice -n 10 /usr/bin/updatedb
    
    # Once the slocatedatabase us updated perform your search.
    
    /usr/bin/locate *.{exe,avi,mp3}
    
    # That's all there is to it.
    Feel free to use, modify, and distribute.
    Tim Ryberg, InterWorx L.L.C. | InterWorx Hosting Control Panel 3.0!
    Views expressed are the author's own and do not represent those of InterWorx L.L.C. unless stated otherwise.
    Join me in my personal quest for The Ultimate CMS!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •