4 Replies Latest reply: Apr 30, 2013 7:16 AM by helicopter
helicopter Level 1 Level 1 (0 points)

I am running Mountain Lyon with os x server.  I am having camera files sent to my server from security cameras. I'd like to do the following


     *  turn on anonymous ftp

     *  limit how many files anonymous ftp can put on server - don't want to fill the hard drive with "stuff".  I would like an anonymous or user that can not log in directly to the mac.... I did notice that I can restrict a local user (one that can log into the desktop)

     *  after 5 days (or X number of days) have those security pictures deleted. 


thank you for looking at this, and for any and all help you all send my way.

OS X Mountain Lion (10.8.3), Mini
  • UptimeJeff Level 4 Level 4 (3,420 points)

    I'll leave the FTP part to you..


    the auto-delete is something I deal with all the time.


    To test (assumes extension of avi and 5 day purge)

    sudo find /path -name "*avi" -mtime +5 -exec echo rm {} \;


    If results look OK, drop the echo

    sudo find /path -name "*avi" -mtime +5 -exec rm {} \;


    As far as automating this.. Some would use launchd, and it may be the best option.

    I'm a bit old-school and would use crontab, if I wanted this to run every night at 2:00am

    edit /etc/crontab


    0 2 * * * root  find /path -name "*avi" -mtime +5 -exec rm {} \;



    this was just an example.. you may have to adjust to suit you environment



  • helicopter Level 1 Level 1 (0 points)

    Thank you Jeff.  It has been a while since I've done UNIX scripts.... I forgot all about that one. 

  • UptimeJeff Level 4 Level 4 (3,420 points)

    Glad to assisst :-)

  • helicopter Level 1 Level 1 (0 points)

    I changed the script that was given, because I'm removing directories that have the format of: YYYYMMDD


    If anyone is interested, here is the modified script.



    #  this program removes security camera directories that are over 5 days old.


    # the below variable, year, is being given from the computer clock and is a 4 digit number - %Y

    year=$(date +%Y)



    sudo find /Users/Shared/ftp-camera/SecurityCamera -iname "$year"* -Btime +5d -exec rm -rf {} \;