Delete all files in the download folder

445 views
Skip to first unread message

Miguel Guerreiro

unread,
Mar 26, 2015, 6:02:51 AM3/26/15
to tas...@googlegroups.com
Hello everyone,

I just bought Tasker and i'm a great noob at this.
I saw several topics about deleting files, but i'm struggling to put them in action.

I need to delete all files inside the download folder with one click.
How can i do this?

Thx in advanced,
Miguel

Abdullah Alahdal

unread,
Mar 26, 2015, 7:38:16 AM3/26/15
to tas...@googlegroups.com
As per my knowledge you need to do a For Loop.

Following is my task description

Delete Files (214)
 A1
: List Files [ Dir:test Match: Include Hidden Files:Off Use Root:Off Variable:%files_list ]
 A2
: Variable Set [ Name:%len To:%files_list(#) Do Maths:Off Append:Off ]
 A3
: For [ Variable:%file Items:%files_list(1:%len) ] If [ %len > 0 ]
 A4
: Delete File [ File:%file Shred Level:0 Use Root:Off ]
 A5
: Flash [ Text:%file deleted Long:Off ]
 A6
: End For

Miguel Guerreiro

unread,
Mar 26, 2015, 8:40:27 AM3/26/15
to tas...@googlegroups.com
Thank you Abdullah :)
But what task i choose to put that code? What's the steps?
Sorry for my noobness....

Jeremy Harris

unread,
Mar 26, 2015, 10:25:58 AM3/26/15
to tas...@googlegroups.com
Abdullah's method should work just fine but may take a little bit of time if there are many files in the folder. If you are CERTAIN that every file in the folder is disposable, you can do a Delete Directory action with Recurse checked. Then just create a new directory (which will now be empty).

Miguel Guerreiro

unread,
Mar 26, 2015, 11:24:09 AM3/26/15
to tas...@googlegroups.com
I'm not very fond of deleting a system folder..
Actually would be nice to narrow the files to only pdf files..
And i can see that Abdullah code can do that.
But the code he gave cannot be used exactly like he gave right? It's just explaining i think..
What action i must choose to put is code and where should i put it in the action?
And how would the code be like to delete the pdf files in the download folder? Like this?:
List Files Download %files
Variable Set %len %files_list(#) Do Maths:Off Append:Off
For %file %files(1:%len) If %len > 0
Delete File %file Shred Level:3 Use Root:Off
Flash %file deleted Long:Off 
End For 

Jeremy Harris

unread,
Mar 26, 2015, 11:32:19 AM3/26/15
to tas...@googlegroups.com

I'm not very fond of deleting a system folder..

Then you want to do Abdullah's method for sure.

But the code he gave cannot be used exactly like he gave right? It's just explaining i think..

It looks pretty good to me. It's a description of how to build the task. Each item is an action that you need to put in your task.

Actually would be nice to narrow the files to only pdf files..

When building your List Files action, put *pdf into the field for Match

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/ripGToJPlhg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Miguel Guerreiro

unread,
Mar 26, 2015, 9:41:54 PM3/26/15
to tas...@googlegroups.com
Worked!! I wasn't understanding the several tasks thing.. i was doing all the code at one task... stupid i know....

Miguel Guerreiro

unread,
Mar 26, 2015, 9:42:22 PM3/26/15
to tas...@googlegroups.com
Thank you very much!!
Worked :)


quinta-feira, 26 de Março de 2015 às 11:38:16 UTC, Abdullah Alahdal escreveu:
Reply all
Reply to author
Forward
0 new messages