Cannot find command to delete files older than 30 days.

783 views
Skip to first unread message

Joshua A

unread,
Jun 17, 2013, 12:10:44 PM6/17/13
to tas...@googlegroups.com
I would like to delete files in specific directories that are older than 30 days. I've tried "find /sdcard/somedir -mtime +7 -exec rm -f {} \;" from both the Secure Settings plugin and Task->Run Shell with no success. I've installed a terminal emulator to test commands and get "find: Not found" error 

This is an unrooted Milestone X2 release 2.3.6 Tasker version 1.6u2m

Matt R

unread,
Jun 17, 2013, 1:20:45 PM6/17/13
to tas...@googlegroups.com
Since you don't have the find command, you would need to update busybox to get that command included. However, without root, it may not be possible. I think I've heard of some people being able to update busybox with one of the busybox apps in the Play Store without root, but I would say that's a longshot.

Matt

bdanders

unread,
Jun 17, 2013, 2:55:34 PM6/17/13
to tas...@googlegroups.com
It can be done with just tasker using "List File" and a For loop testing each file data and deleting if it's too old.

Joshua A

unread,
Jun 17, 2013, 3:35:54 PM6/17/13
to tas...@googlegroups.com
Bdanders.. That will be over my head on how to accomplish. Would you help with the specific commands? Sorry for my ignorance. 

bdanders

unread,
Jun 17, 2013, 4:17:57 PM6/17/13
to tas...@googlegroups.com
See if this works for you. Test it out thoroughly using the popups before you activate the delete command. And of course you're going to want to change the File list command to your directory of choice. Also, I use a custom popup named "My Popup" that is larger than the default popup, so you'll need to either make your own, or change the layout.

Delete Old Files (391)
A1: List Files [ Dir:Zoom/cache Match:*.bmp Include Hidden Files:Off Variable:%file_list ]
A2: Variable Set [ Name:%len To:%file_list(#) Do Maths:Off Append:Off ]
A3: For [ Variable:%file Items:%file_list(1:%len) ] If [ %len > 0 ]
A4: Test [ Type:File Modified Data:%file Store Result In:%file_date ]
A5: Variable Set [ Name:%file_age To:(%TIMES-%file_date)/(3600*

24) Do Maths:On Append:Off ]
A6: Popup [ Title: Text:%file
%file_age Background Image: Layout:My Popup Timeout (Seconds):2 Show Over Keyguard:On ]
A7: If [ %file_age > 30 ]
A8: Popup [ Title:Delete Text:%file
%file_date Background Image: Layout:My Popup Timeout (Seconds):5 Show Over Keyguard:On ]
A9: [X] Delete File [ File:%file Shred Level:0 Use Root:Off ]
A10: End If
A11: End For

Delete_Old_Files.tsk.xml

Joshua A

unread,
Jun 18, 2013, 7:23:47 AM6/18/13
to tas...@googlegroups.com
Perfect.. That did it. Thank you for the how to. 

Rich Belthoff

unread,
Aug 9, 2014, 2:58:52 PM8/9/14
to tas...@googlegroups.com
I found your task when searching and downloaded it but I can't get it to work properly. I set it to look in my download folder where I know I have old files. I got rid of your BMP file extension. I out some Flash actions in to test. %len flashes as 19 but the if %len > 0 always shows a red line. Shouldn't it be green?

Also, I tried to check the popup. However, no matter how I try to configure it I get an error that a popup must have a text element of text1.

Any ideas what I'm doing wrong? Thanks!

Rich

Joshua A

unread,
Aug 17, 2014, 2:49:55 PM8/17/14
to tas...@googlegroups.com
Here's what I use to clean old Evernote files. not  just bmp. Change the directory to where you want, enable the flash notifications, and check log file for progress.
Utility_Clean_Phone_Sub_Evernote.tsk.xml

an.po...@gmail.com

unread,
Oct 24, 2018, 4:54:27 AM10/24/18
to Tasker
Thank,
Everything works great!


воскресенье, 17 августа 2014 г., 21:49:55 UTC+3 пользователь Joshua A написал:

Jorge Luis

unread,
May 1, 2019, 2:57:14 PM5/1/19
to Tasker
Thank you this is just great!!
Reply all
Reply to author
Forward
0 new messages