iRev How do I manage a different folder full of images

Sarah Reichelt sarah.reichelt at gmail.com
Mon Dec 21 19:55:50 EST 2009


On Mon, Dec 21, 2009 at 11:34 PM, Thomas McGrath III <mcgrath3 at mac.com> wrote:
> Hello all and happy holidays to you all,
>
> I made an app for uploading photos remotely to a folder on on-rev. I also
> have another folder that feeds a mobile viewer app. What I would like to do
> is manage both of these folders.
>
> 1. When uploaded to folder A. after it reaches a predetermined amount like
> 10 then make a DUPLICATE of them to folder B.?
> 2. Be notified via an EMAIL that this has happened at certain TIMES.
> 2. When folder A. reaches say 150 then DELETE all images in Folder A. (MAKE
> SURE all have been moved to folder B. though)
> 2. Keep an eye on folder B. when it reaches say 100 images then MOVE the
> oldest photos to a new CREATED folder C. or if that is FULL than MOVE to a
> new folder D. etc.
>
> How/what is the best way to do this in iRev scripts???
>
> Duplicating, Deleting, Moving and then Creating folders
> Time Checks and Email/notifications


All the folder creation, file moving & file deleting stuff is just the
same as in normal Rev scripts, and if done by an irev script file,
will work perfectly online without any privilege problems.
Emails can also be sent by an irev file - I use a set of functions by
Splash21 that do emails. You can see the script here:
<http://www.troz.net/onrev/samples/showscript.irev?showscript=includes/mail.irev>.

The real issue is the trigger for these scripts to run. If you wan
them to run at specific times, then you will need to set up a cron job
using your cPanel. This link is down the bottom in the Advanced
section. Choose the Standard interface, and enter the command to run
as something like this:
    curl http://yourusername.on-rev.com/processPhotos.irev
Then select the time intervals.

However before you set this up, you need to make sure the irev script
is doing it's job, so I would write a version that produced output
into the browser that told you what it was doing as it did it. Once
that is debugged, you can make a silent version and use it for the
cron job. You can also set up the cron job to email you whenever it
operates. This is useful at first to confirm the task is happening
when scheduled and to make sure there are no errors, but once it is
all happening as required, you probably won't want this happening
every time.

HTH,
Sarah



More information about the use-livecode mailing list