Page 1 of 1
File rotation in the directory
Posted: 17 Sep 2014 12:17
by takehito
Triggers run in 0:00 AM every day at the specified time
What can I do to the processing number of files, such as to avoid 5 or more at all times the number of files in a directory called "/storage/emulated/0/sample" will delete the old files in the case of 5 or more?
Re: File rotation in the directory
Posted: 17 Sep 2014 16:54
by Martin
Hi,
You could use an action Init Variable File List to store all files with a certain name in a list and then use action Delete Files to delete some of the files.
Regards,
Martin
Re: File rotation in the directory
Posted: 18 Sep 2014 01:09
by takehito
I tried to set up in this way, but it does not always work as I think.
Step 1
Action: Init Variable File List
Variable: files
File Pattern: /storage/emulated/0/sample/*
Step 2
Action: Script
Script:
listlength = length(files);
if (listlength > 5)
{
removeElement(files, listlength - 1);
}
Step 3
Condition: Expression
Expression:
length(files) > 5
Step 4
Step 3 If the True
Action: Delete Files
Files: {files, listformat, comma}
When it is this Flow, and will not be operational files of 6 th until a generation.
All from being removed, leaving a single new file file 6 th is generated.
To make an operation to remove one old file file of 6 th is generated it, in Step3 and Step2, I want you to tell me should I describe what the script.