Page 1 of 1
Move files except the last file
Posted: 01 Oct 2018 20:10
by doc11
Hello,
i have log files for every single day with the file format "yyyyMMdd.txt".
how can i move all files except the current day to another folder?
Re: Move files except the last file
Posted: 01 Oct 2018 20:33
by digitalstone
Are you familiar with loop iterations?
you could first store the amount of files within your folder, inside a list.
Then inside the loop:
look at each upfollowing file.
If its name equals today's date, then "don't copy" else "copy".
Re: Move files except the last file
Posted: 01 Oct 2018 21:09
by doc11
I found the following solution from Desmanto in the other thread:
viewtopic.php?f=5&t=6905
Only need the single line script
Code: Select all
removeElement(files, indexOfElement(files, "/storage/emulated/0/source/{getDate(),dateformat,yyyyMMdd.txt}"));
Then use {files,listformat,comma} at the Action Move Files.
Re: Move files except the last file
Posted: 01 Oct 2018 21:44
by digitalstone
Very nice, i wasn't aware of a dedicated function like that.
But for "educational purposes":
Under the hood, i bet it would perform a similar process like i described though.
It has to check every file up til the one you're looking for eventually somehow.