-1

The problem I'm trying to solve is this one:

We have a set of cameras which send pictures at intervals to a FTP server, the cameras generate a whole folder/camera/hour structure and everything is fine, but when the quota is reached new pictures get deleted.

The desired behaviour is that when new pictures arrive at the ftp server the older pictures get deleted leaving space for the new ones.

So far I've been trying to configure pro-ftpd to work like this to no avail, is there any hidden functionality I'm not aware of? Or maybe there are other FTP servers which would solve my problem?

Thanks in advance.

  • I don't know of a single one that would do such a thing - it is only a File __Transfer__ Protocol after all, not a file management suite. I suspect you'll have to script something that runs on your server - maybe under cron daemon. – Mark Setchell Mar 18 '14 at 09:25

1 Answers1

0

If you've access to the server (and that seems to be the case, since you're looking for a conf) : why don't you just delete oldest pic each time a new pic is uploaded ?

function clear_oldest() { local file oldest; oldest=$(mktemp); for dir in "${1:-.}"/*; do { [[ $dir -ot $oldest ]] && oldest=$dir; } done; rm -f $oldest }

sync it via cron to the upload rate, and the job should be somehow done.

NA: remember to 'fix' quotas. FTP won't probably be aware you deleted it via FS.

user1293137
  • 103
  • 5