Problem with using find at command prompt

Discussion in 'Tomato Firmware' started by Insanity, Aug 28, 2009.

  1. Insanity

    Insanity Addicted to LI Member

    Hi everyone,

    I recently set up an Asus WL-520GU up with Tomato (Tomato Firmware v1.25.8632 ND USB Std) and a USB drive to act as a host to some Panasonic NetCam security cameras. These cameras have a limited amount of on-board storage (enough for 127 images at my chosen resolution), but can use ftp to transfer image files to another server, in this case my Tomato router.

    My plan is to run a "find" command each night via Tomato's WebGUI scheduler and have the find command delete image files that are more than 14 days old. Otherwise my little thumb drive will run out of space!

    Unfortunately Tomato's find doesn't seem to recognize standard find options. Makes "find" less useful than "ls".

    Here's the command I planned to use and the response at the command line:

    root@tomato:/usr/bin# find /mnt/Transcend/InsanityCam -mtime +14 -depth -mindepth 1 -delete

    find: unrecognized: -mtime
    BusyBox v1.14.1 (2009-06-13 02:08:53 EDT) multi-call binary

    Usage: find [PATH...] [EXPRESSION]


    Am I missing something? Is there a fully functional Linux find utility for Tomato somewhere?

  2. Planiwa

    Planiwa Network Guru Member

    # delete all but 100 most recent files in current directory that match pattern:
    set -- $(ls -t images*)
    shift 100 &&  rm "$@"
  3. Insanity

    Insanity Addicted to LI Member

    Hmm. I'm sure it would work if there were a limited number of files in the directory, but would a local set variable hold 50,000 or more file entries without hitting an overflow?
  4. Planiwa

    Planiwa Network Guru Member

    Aha. 50,000 sure is a different magnitude from 14 and 127. :)
    So, I am guessing that there are perhaps 4,000 files/day.

    You could store these files in date-named directories: e.g. '0830'.
    Then just remove (with contents) the oldest of the (14) directories.
  5. Insanity

    Insanity Addicted to LI Member

    Yea, that would be my preference in any case, but the camera logic doesn't permit it. <sigh>

    Why doesn't find work? Can I cross-load an x86 Linux (Ubuntu, RedHat, etc) find, or is the Broadcom CPU and build totally different?
  6. jan.n

    jan.n LI Guru Member

    I did not check the source but IMHO neither the shell nor awk are tomato-specific. Are you really implying that the Tomato developers are "random dimwits"?

    One of the major advantages of open source software: If you're not happy with Tomato (or busybox, awk, the shell or any other component of the system), then get the source and compile "a set of uncrippled binaries" yourself.

    If you succeed, please share your knowledge.
    If not, please check your remarks and language.
  7. Insanity

    Insanity Addicted to LI Member

    How I resolved my problem.

    I should have posted this a long time ago. I solved my USB drive file system congestion problem by having Tomato (Teddy Bear Mod) run a script at midnight each day. The script manages content in a series of 31 numbered folders that age the image archive off, using rm to delete the content of folder 31 and mv to move the images from folder 30 to 31, 29 to 30, 28 to 29, and so on.

    Works pretty well.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice