Check for new subfolder and delete the oldest one?
Posted: 17 Jan 2014 11:40
Hi,
So what i want to achieve is that via Rom Manager i have scheduled to create Nandroid backups of my phone every 4 days or so. As my nandroid backups tend to be rather large 6GB+ or soI want to create a flow that checks if there is new subdirectory (which contains the new nandroid backup) and if yes then to delete the previously stored backup on my phone so that at any given time i allways only have one huge ass nandroid backup on my phone which should be the latest one.
So what i did so far is i can setup the event trigger File Observer to check for Subfile created so it looks at the Nandroid backup directory if a new subdirectory has been created.
Now this is the point where i am stuck as i do not find a condition or action type which would allow me to setup check to look for the oldest subdirectory (based on timestamp i guess) and then delete it and leave the other one in tact.
Any ideas how i could achieve this? I guess this could be done with a script maybe or something but i am really not confortable in doing those yet.
Any help would be appriciated.
Thanks
So what i want to achieve is that via Rom Manager i have scheduled to create Nandroid backups of my phone every 4 days or so. As my nandroid backups tend to be rather large 6GB+ or soI want to create a flow that checks if there is new subdirectory (which contains the new nandroid backup) and if yes then to delete the previously stored backup on my phone so that at any given time i allways only have one huge ass nandroid backup on my phone which should be the latest one.
So what i did so far is i can setup the event trigger File Observer to check for Subfile created so it looks at the Nandroid backup directory if a new subdirectory has been created.
Now this is the point where i am stuck as i do not find a condition or action type which would allow me to setup check to look for the oldest subdirectory (based on timestamp i guess) and then delete it and leave the other one in tact.
Any ideas how i could achieve this? I guess this could be done with a script maybe or something but i am really not confortable in doing those yet.
Any help would be appriciated.
Thanks