Forgot your password?
typodupeerror
The Internet

Kymermosst's Journal: Let me save you $10 5

Journal by Kymermosst

I was browsing around freshmeat and found this little gem of a shareware program.

Here's the scoop from the description page. For only $10 you get:

General:

        * Delete ALL files (in the specified directory) with file dates older than the specified days.
        * For Unix/Linux system only.

Features:

        * E.g. Delete all files older than 30 days - regardless of the permission setting of the files.
        * Can be run manually from browser, telnet or automatically using crontab.
        * Support deletion of files in multiple folders and of different ages.
        * Only two variables to edit - the directory and the file age.

Requirement:

        * Perl
        * No MySQL needed.
        * No SSI needed.

Here's what they are charging $10 for. Only they've written it in perl.

--- BEGIN CUT HERE ---
  #!/bin/sh
  DIR=/path/to/directory
  AGE=30
  find $DIR -mtime +$AGE -exec rm -f {} \;
--- END CUT HERE ---

Only two variables to edit, deletes everything in the specified directory (DIR) older than AGE days. You can even do multiple directories with different ages by deleting the DIR= and AGE= and copying the find command a few times, substituting the values in for $DIR and $AGE. You can run it as-is from telnet, and from cron, and by adding "echo Content-type: text/plain ; echo" at the top, it might even run as CGI.

Oh, and you can have the above for free. But if you want to send me $10 for all 10 seconds that took to write, be my guest.

This discussion has been archived. No new comments can be posted.

Let me save you $10

Comments Filter:
  • by ncc74656 (45571) *
    With its reputation for enabling code that is barely distinguishable from line noise, Perl is the perfect choice for such an app...if you're trying to sell it. It makes it harder for the unwashed masses to tell just how badly you've just ripped them off. :-)
  • Yes, but do you offer lifetime free upgrades & support? :)
    • by Kymermosst (33885)
      If I ever think of a way to do it more efficiently and produce a new version, I'll be sure to post it in my journal...
  • find $DIR -mtime +$AGE -exec rm -f {} \;

    I frequently want to do something (could be anything) to the files listed by a find command. I've usually done something like for i in `find ...`; do ... $i; done, but that chokes if the filenames returned by find include spaces or certain other characters. I didn't know there was an option to have find run arbitrary commands with its output, and it looks like it handles all filenames properly. Sweet!

    • by Kymermosst (33885)
      I know a few more find tricks. I use Samba to serve files, several Windows clients connect. Check out my incremental virus scan of /home using F-prot for Linux workstations [f-prot.com] (free as in beer)... only scans directories that changed since yesterday:

      #!/bin/sh
      SCANBASE=/home
      SCANDATE=`date +"%D"`
      if [ -x /usr/local/f-prot/tools/check-updates.pl ]; then
      UPDATE=`/usr/local/f-prot/tools/check-updates.pl -cron`
      if [ -n "$UPDATE" ]; then

A CONS is an object which cares. -- Bernie Greenberg.

Working...