Re: Check if files are todays date, copy to specific folder (that's synced with dropsync)

644 views
Skip to first unread message

Rich D

unread,
May 31, 2013, 7:03:44 AM5/31/13
to tas...@googlegroups.com

> I've tried the list file/browse file and %Date. The thing is, all my images/videos begins with "yyyyMMdd_HHmmSS".

This looks like the perfect application for Uncle Mikes date formatting task.

This is how I would proceed...

1. Go here..

http://tasker.wikidot.com/getformatteddate

Read the explanations and download the task. Check the user's guide on the Preform task action.

2. Make sure you have de- selected beginners mode tasker preferences

3. In tasker under the task Edit tab ( where you view a list of all your tasks) Long press on the tasks tab.( this will probably be a little different for the new UI but you should be able to locate a menu with the import option)
Select the downloaded task and import it. 

4. Now build a simple task to check the dates. It should look something like this..

Task: Get Date

A1. Perform Task [ Name:getFormattedDate Stop:Off Priority:10 Parameter 1 (%par1):%TIMES Parameter 2 (%par2): yyyymmdd Return Value Variable:%filename ]

A2. Flash %filename

5. Now you have today's date in the format as your pics are in. You should be able to use this to match the file names with the "list files" action. Check the user guide under 'pattern matching' but your match should look this....   *%filename*   that should list all files with today's date in the file name...

Let me know if you get stuck any where...

Rich..

Thomas Nikolai Blekeli

unread,
May 31, 2013, 5:20:41 PM5/31/13
to tas...@googlegroups.com
Thank you so much for the feedback! But I'm struggling to find your task. I've downloaded it and chose tasker to open the file. It says its ready to import, but I can't find it. it's nothing in the folder. even tried to manually download the file, won't find it that way either.. Only blank. Will try to figure out why and then test your settings (can't wait, thank you so much yet again!)

Rich D

unread,
May 31, 2013, 5:26:41 PM5/31/13
to tas...@googlegroups.com

Hmmmm, there should be a menu that has ' Import' as a option in the task edit tab.. ( It is a long press on the tab that says 'Tasks' in the old UI)..  hopefully someone with the new UI can chime in....

Rich..

Thomas Nikolai Blekeli

unread,
May 31, 2013, 5:33:15 PM5/31/13
to tas...@googlegroups.com
Wow, that was fast :). I've tried to go to tasks, push the home-button in lower left and then choose import. But nothing, its blank. Even tried to choose profiles, scenes and vars and do the procedure, all the standard folders are blank. Even tried to open home from profiles/tasks/scenes/vars and then navigate to downloads, where i know theres a copy. But nothing.

I've tried to make a file browse and navigate to /storage/emulated/0/DCIM/Camera and that bugs a lot (it leaves out "DCIM" and says it can't find the directory), maybe theres something with tasker, android 4.2 and directory-browsing? Just my random guess..

Rich D

unread,
May 31, 2013, 5:37:24 PM5/31/13
to tas...@googlegroups.com

> Wow, that was fast :). I've tried to go to tasks, push the home-button in lower left

I believe that is a project tab so you are trying to import a project not a task... you need to find the import for the 'tasks'..

Rich D

unread,
May 31, 2013, 5:41:26 PM5/31/13
to tas...@googlegroups.com

It should be in a similar location to this... using a regular file browser..

/mnt/sdcard/Tasker/tasks/

But you need to locate the import task feature in tasker to properly import it.....

Rich..

Thomas Nikolai Blekeli

unread,
May 31, 2013, 5:42:15 PM5/31/13
to tas...@googlegroups.com
Aaaand im a total noob. Thank you so much, it worked! Long pressed the task-button and chose import. Awesome! Even though I'm already halting at the import I believe this is going to take a while before I have anything that works. If you're ever visiting Norway, give me a call so I can buy you a coffe, haha! :)

Rich D

unread,
May 31, 2013, 5:48:03 PM5/31/13
to tas...@googlegroups.com

that works. If you're ever visiting Norway, give me a call so I can buy you a coffe, haha! :)

Deal.... let me know if you get stuck again...

>
> --
> You received this message because you are subscribed to the Google Groups "Tasker" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
> Visit this group at http://groups.google.com/group/tasker?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Thomas Nikolai Blekeli

unread,
May 31, 2013, 5:52:04 PM5/31/13
to tas...@googlegroups.com
It works!!! You're awesome! I've added the Camera-directory with the browse-file task, it shows todays pictures. Going to try to copy them to another folder on the local storage. This is so awesome!

Thomas Nikolai Blekeli

unread,
May 31, 2013, 6:07:20 PM5/31/13
to tas...@googlegroups.com
I'm so embarrassed for asking so much stupid questions. You've been real helpsome, Rich D. But I tried to use the copy-task, but it seems that it will only copy one instance, do I have to make an array? How can I tell tasker to find only the files from today and copy them to a folder? Sorry for me being such a noob. If there's a guide out there I would gladly read it and try to learn by myself so I don't need to bother you guys :)

Rich D

unread,
May 31, 2013, 6:16:00 PM5/31/13
to tas...@googlegroups.com

. But I tried to use the copy-task, but it seems that it will only copy one instance,

Not sure why you are copying a task.. which task are you trying to copy and why?

do I have to make an array?

The 'list files ' action creates an array..

How can I tell tasker to find only the files from today and copy them to a folder?

Lets start slow... did you get the task I recommended to work and flash today's date in the proper format?

Sorry for me being such a noob. If there's a guide out there I would gladly read it and try to learn by myself so I don't need to bother you guys :)

There is a beginners guide.. I like the pocketables one my self.  It should be in the main menu selection..

Thomas Nikolai Blekeli

unread,
May 31, 2013, 6:21:21 PM5/31/13
to tas...@googlegroups.com
Sorry, I meant copy-action. Also tried to make a list-file action and match %Filename with the a variable I named %CopyDateFiles, when I flash it it only shows the variable as plain text (like this %CopyDateFile)..

Rich D

unread,
May 31, 2013, 6:43:32 PM5/31/13
to tas...@googlegroups.com


> Sorry, I meant copy-action.

Copy what?

Also tried to make a list-file action and match %Filename with the a variable I named %CopyDateFiles, when I flash it it only shows the variable as plain text (like this %CopyDateFile)..

The list will be in the ARRAY %CopyDateFiles.   Try flashing %CopyDateFiles(:)   this should give a comma separated list of the array..

Check array in the user guide under variables..

Rich D

unread,
May 31, 2013, 7:03:52 PM5/31/13
to tas...@googlegroups.com

Btw.. since you are using a global variable the array should be able to be seen in the variables tab with the rest of your global variables.. this is OK for testing but when all is working good you will want to make this a local variable/array....

Thomas Nikolai Blekeli

unread,
May 31, 2013, 7:09:40 PM5/31/13
to tas...@googlegroups.com
Thank you yet again, Rich D, I only got a black square. Well, I think om getting closer, but can I make the "match" in list file (or the If-category) to be partially correct? For instance, dir: DCIM/Camera, and match partially %FileName, variable: %FilesToMove.And that the files that starts with e.x 20130106(_xxxxxx)?

And then make a

2. "For"-function with variable %FilesToMoved, items:"%FilesToMove()"
3. "Move" from:%FilesToMoved, to:"dropsynctest"
4. "End For"

(Borrowed the move-task from bourne-nolonger at https://groups.google.com/forum/m/?fromgroups#!topic/tasker/nUuFX5gfbwc)

Thomas Nikolai Blekeli

unread,
May 31, 2013, 7:40:08 PM5/31/13
to tas...@googlegroups.com
It's alive! I changed the move-function with "copy" and added sync now-plugin to dropsync. It works flawlessly with a nfc-card.

1. Swipe NFC-card
2. Checks if images/videos are created today
3. Copies them to a different folder
4. Syncs the folder with dropbox-folder via dropsync

This is so awesome. Think I owe you a whole trip to Norway, Rich D! :) Now I have to make use the weekend to refine the code. Any tips? :)

Rich D

unread,
May 31, 2013, 7:51:46 PM5/31/13
to tas...@googlegroups.com

> It's alive!

Great.. glad you got it..

> This is so awesome. Think I owe you a whole trip to Norway, Rich D! :)

OK... is this summer good for you??    :)

Now I have to make use the weekend to refine the code. Any tips? :)


Could you post your profile here...  Long press on the profile name / ( 3 dot menu with 4.0+ ) export / export description to clipboard (not XML)

The beginner mode needs to be off and the profile needs to have a name to be able to export.  

Bob Hansen

unread,
May 31, 2013, 7:53:50 PM5/31/13
to tas...@googlegroups.com
Congratulations on the success!

It would help if you posted a tasker description of your profile or task. To do this, long press on the profile (or task) to select it. Then tap the menu icon and from the menu select Export > Description to clipboard (not XML). 
Note: The profile or task must be named in order to export it.

Thomas Nikolai Blekeli

unread,
May 31, 2013, 8:00:08 PM5/31/13
to tas...@googlegroups.com
Hehe, Norway's so expensive. Let's say next year, have to save some money :p

Heres the description. After upload dropsync deletes rhe files in the folder. I wish i could create a notification that the job is done. Thats next on my list.

In advance, sorry for the somewhat lousy programming beneath.

CopyFilesDB (14)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ]
A2: For [ Variable:%FilesToMoved Items:%FilesToMove() ]
A3: Copy File [ From:%FilesToMoved To:dropsynctest Use Root:Off ]
A4: [X] Move [ From:%FilesToMoved To:dropsynctest Use Root:Off ]
A5: End For
A6: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]

Thomas Nikolai Blekeli

unread,
May 31, 2013, 8:07:28 PM5/31/13
to tas...@googlegroups.com
And I need the task to write filenames to a file so it can check whether or not the files has been copied earlier so it only copies new files. In case I have to use it multiple times a day and especially since the receiving end copy and deletes the files..

Any input and tips for how the heck I'm supposed to do that would be highly appreciated :)

Bob Hansen

unread,
May 31, 2013, 8:13:44 PM5/31/13
to tas...@googlegroups.com
There is absolutely nothing lousy about it. It's as clean, efficient and effective.
I would change the variable:%FilesToMoved to %filestomoved (all lower case letters) to make it a local variable and get rid of the unused Move action.

For the notification that the job is done,
add action > Alert > Notify [Title: what ever you want  Text:  the job is done! ]

Thomas Nikolai Blekeli

unread,
May 31, 2013, 8:19:23 PM5/31/13
to tas...@googlegroups.com
Thanks Bob, appreciate it! But the main work is thanks to Rich D and bourne-nolonger (https://groups.google.com/forum/m/?fromgroups#!topic/tasker/nUuFX5gfbwc)

Bob Hansen

unread,
May 31, 2013, 8:36:55 PM5/31/13
to tas...@googlegroups.com
To check for existing files in the destination directory, you simply add a second List Files action using the destination directory. The in the If condition option of the Copy File action add the If option (check the box) and add  If %FileToMoved !~ %FilesMoved ]  (!~ means 'not match'). If it doesn't match then copy the file. If it does match then the file already exists.


CopyFilesDB (14)
        A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ] 
        A2: List Files [ Dir:<your path here> Match:%Filename* Include Hidden Files:Off Variable:%FilesMoved ] 
        A3: For [ Variable:%FilesToMoved Items:%FilesToMove() ] 
        A4: Copy File [ From:%FilesToMoved To:dropsynctest Use Root:Off If %FileToMoved !~ %FilesMoved ] 

Thomas Nikolai Blekeli

unread,
Jun 1, 2013, 6:00:13 PM6/1/13
to tas...@googlegroups.com
Thanks for the reply, Bob. But I don't think it'll work since dropsync deletes the files after upload is a success. I think that after the copy-action I need a *.txt file (in another location) that writes down the name of the files thats been copied so I can check next time if the files are listed in the file.txt, but how the heck do I do that? :) and action number two must be to reset file.txt the next day wen the task is being started. I seriously need some input/help to do that.

Thomas Nikolai Blekeli

unread,
Jun 1, 2013, 6:15:56 PM6/1/13
to tas...@googlegroups.com
Perhaps I'm thinking of this all wrong. Maybe the files that's been copied shouldn't be deleted as soon as sync is complete. Åerhaps the files can kust lay there so I can use your list file command, Bob. And then make a new function (that if it is the next day) the tasks checks if the files in the synced folder doesn't match the todays date and then deletes them before starting the nornal procedure (copy todays tasks and then sync and keep)

Bob Hansen

unread,
Jun 1, 2013, 6:32:53 PM6/1/13
to tas...@googlegroups.com
There are several options as to how you could do what you want. Below I added a line to write the copied files to a text file. Each file on a separate line. It's the learning that is important now, so try different ideas and enjoy(?) learning Tasker :>)

CopyFilesDB (14)
        A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ] 
        A2: List Files [ Dir:<your path here> Match:%Filename* Include Hidden Files:Off Variable:%FilesMoved ] 
        A3: For [ Variable:%FilesToMoved Items:%FilesToMove() ] 
        A4: Copy File [ From:%FilesToMoved To:dropsynctest Use Root:Off If %FileToMoved !~ %FilesMoved ] 
       A5: Write File [ Path:<your path to text file> Text: %FilesToMoved  Append: On Add Newline: On 
        A6: End For 
        A7: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]  

Thomas Nikolai Blekeli

unread,
Jun 1, 2013, 6:56:29 PM6/1/13
to tas...@googlegroups.com
Thank you so much, Bob! I'll try it tomorrow.

Oh, it's indeed a pleasure to work with tasker. I'm currently trying to make a system that doesn't need coursing. I'll try to figure out as much as I can by myself, but your input is priceless. It's easier to get that kind of answer and then try to build upon that and learn how to use rhe different actions in tasker :) wish I could buy you a coffee for that answer (and to Rich D)

Thomas Nikolai Blekeli

unread,
Jun 2, 2013, 8:04:03 AM6/2/13
to tas...@googlegroups.com
So, I`ve managed to create a file.txt in another location that stores the filnames of the images/videoes that`s copied and synced with dropbox. But, I have a couple of issues, first, I`ve tried to make an "If"-sentence in Copy-action so it checks wether the file it should copy matches the filenames in the file.txt and if so do not copy. But I cant get it to work, it copies it anyway.

Second. It writes the filenames that already exists in the file.txt. Help please? Here`s the code I have so far:

CopyFilesDB (14)

A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%filestomove ] 

A2: For [ Variable:%filestomoved Items:%filestomove() ] 

A3: Read File [ File:DBuploadtext/uploads.txt To Var:%readfilesuploaded ] 

A4: Copy File [ From:%filestomoved To:dropsynctest Use Root:Off ] If [ %filestomoved() !~ %readfilesuploaded() ]

A5: Write File [ File:DBuploadtext/uploads.txt Text:%filestomoved Append:On Add Newline:On ] If [ %filestomoved() !~ %readfilesuploaded() ]

Rich D

unread,
Jun 2, 2013, 10:07:39 AM6/2/13
to tas...@googlegroups.com

Could you explain exactly what you are trying to check and why..

Is this to check for.duplicate  files from the previous day or to check for duplicate files from the current day or both.. ??

>
> CopyFilesDB (14)
>
> A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%filestomove ] 
>
> A2: For [ Variable:%filestomoved Items:%filestomove() ] 
>
> A3: Read File [ File:DBuploadtext/uploads.txt To Var:%readfilesuploaded



> A4: Copy File [ From:%filestomoved To:dropsynctest Use Root:Off ] If [ %filestomoved() !~ %readfilesuploaded() ]

In this statement you should be using "%filestomoved" not %filestomoved()  

However this will test one array element of %filestomove against the content of the file DBuploadtext/uploads.txt. so I think this action should look like this..

> A4: Copy File [ From:%filestomoved To:dropsynctest Use Root:Off ] If [ *%filestomoved* !~ %readfilesuploaded ]

I am not exactly sure how the "read file" action works as I do not use it often but i believe the way you have it it reads the entire file into the variable but you may have to experiment with it to make sure it is not just reading 1 line of the file...

Rich..

Thomas Nikolai Blekeli

unread,
Jun 2, 2013, 10:12:12 AM6/2/13
to tas...@googlegroups.com
Thanks for the info, Rich D! 

I`m trying to check for duplicates from the same day. As of now the task copies everything from that day everytime I run it. Since the receiving end deletes the files I`ve uploaded I need to have uploads.txt that can store todays files that`s been uploaded and then check if I`m trying to upload duplicates,  and if so, do not copy them to the dropsync-folder.

Rich D

unread,
Jun 2, 2013, 1:14:43 PM6/2/13
to tas...@googlegroups.com

> I`m trying to check for duplicates from the same day. As of now the task copies everything from that day everytime I run it. Since the receiving end deletes the files I`ve uploaded I need to have uploads.txt that can store todays files that`s been uploaded and then check if I`m trying to upload duplicates,  and if so, do not copy them to the dropsync-folder.

OK, that makes sense to me now....

As bob said there are several different ways to approach this. This would be mine..

If it just a check for daily uploads I would not use a file to store the file names already up loaded I would just use a global variable.  I do not think you will have enough data to warrant using a file.  The global variable will make things simpler. 

You will need some logic at the beginning of the task to reset the variable each day.. since the list should only be populated with files that match today's date in the format received back from uncle mikes task you should be able to just do a ...

Variable set %Filesmoved To  ","    ; IF *%Filename* does not match %Filesmoved.

This will put a comma in %Filesmoved which will set it up for easier matching. 

Now just append ( with a 'variable set' action withe append ticked)  the files that are copied to %Filesmoved with a comma on the end so your %Filesmoved variable will look like this

",first_filename_added,second_filename_added,third_filename_added"

To search the variable your search criteria should look like

If  *, %filestomoved,* matches  %Filesmoved. Then do stuff....

Let me know if this is not clear...

Rich..

Thomas Nikolai Blekeli

unread,
Jun 2, 2013, 3:27:36 PM6/2/13
to tas...@googlegroups.com
Thanks for helping me out (and for the patience), Rich D! I'm struggling a bit to understand your code, and am also not able to put * or , in front of a variable.

Heres what I got so far:
CopyFilesDB (14)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ]
A2: For [ Variable:%FilesToMoved Items:%FilesToMove() ]
A3: [X] Copy File [ From:%FilesToMoved To:dropsynctest Use Root:Off ]
A4: Variable Set [ Name:%FilesToMoved To:, Do Maths:Off Append:On ] If [ %Filename* !~ %FilesToMoved ]
A5: Flash [ Text:%FilesToMoved Long:Off ]
A6: End For
A7: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
A8: [X] Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
A9: [X] Say [ Text:Todays images and videos is uploading Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ]

My brain is trying to switch to programming for a couple of days now, but it isn't there quite yet. Even though I try to yell at it :)

Thomas Nikolai Blekeli

unread,
Jun 2, 2013, 6:13:06 PM6/2/13
to tas...@googlegroups.com
Ok, one last thing and I'll leave you guys alone (at least for some time :) ).

No matter what I do now, the For-action will not work. No matter what task I try that has a For-action. Even tasks I knew worked earlier doesn't work with For-anymore. I've even tried to uninstall and reinstall tasker. That helped for a while, but when I tried to make a list-file and then add some other actions it stopped working again, and maaaan I was so near making the task work!! Does it have something to do with Global vs local variables, cause right now im only using global? So frustrating..

Bob Hansen

unread,
Jun 2, 2013, 6:13:54 PM6/2/13
to tas...@googlegroups.com
Your right Thomas. 

You can't put it like this:
If  *, %filestomoved,* matches  %Filesmoved. Then do stuff....    
but you can do it like this:
If  %Filesmoved matches  *,%filestomoved,*. Then do stuff....

I have no idea why it works one way but not the other, but it does.
note: there should not be a space between the comma and the %filestomoved

Rich D

unread,
Jun 2, 2013, 6:20:21 PM6/2/13
to tas...@googlegroups.com

and am also not able to put * or , in front of a variable.

Not sure what you mean here.. what happens when you try to put a * in front? ?

> CopyFilesDB (14)

// this action needs to go before the 'for loop'  and It should have a different name then the variables you have used so far. This global variable is taking the place of the file you were saving the copied file names too//

> A4: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:On ] If [ %Filename* !~ %Filesmoved ]

//                                         //

> A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%FilesToMove ]

I think we need to make the variable names a little easier to understand,
I usually just name the first variable in a for loop  %item.  It only functions within the 'for loop'  so for clarity I think we should change that.

> A2: For [ Variable:%item ; Items:%FilesToMove() ]


// this is where you would put in the check for file names already copied//

> A3: [X] Copy File [ From:%item To:dropsynctest Use Root:Off ]
     If *,%item,* does not match %Filesmoved

//                                               //


> A5: Flash [ Text:%item Long:Off ]


> A6: End For
> A7: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
> A8: [X] Wait [ MS:0 Seconds:3 Minutes:0 Hours:0 Days:0 ]
> A9: [X] Say [ Text:Todays images and videos is uploading Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Continue Task Immediately:Off ]
>
> My brain is trying to switch to programming for a couple of days now, but it isn't there quite yet. Even though I try to yell at it :)

Try those changes and let me know how it works....  read it carefully as I changed a few things...

Rich..

Rich D

unread,
Jun 2, 2013, 6:39:25 PM6/2/13
to tas...@googlegroups.com

> You can't put it like this:
> If  *, %filestomoved,* matches  %Filesmoved. Then do stuff....    
> but you can do it like this:
> If  %Filesmoved matches  *,%filestomoved,*. Then do stuff....

Ahhh, Good catch Bob.... 

Rich D

unread,
Jun 2, 2013, 6:42:57 PM6/2/13
to tas...@googlegroups.com

> No matter what I do now, the For-action will not work. No matter what task I try that has a For-action. Even tasks I knew worked earlier doesn't work with For-anymore. I've even tried to uninstall and reinstall tasker. That helped for a while, but when I tried to make a list-file and then add some other actions it stopped working again, and maaaan I was so near making the task work!! Does it have something to do with Global vs local variables, cause right now im only using global? So frustrating..

Most likely the problem... I am not sure you can use a global variable for the first variable in the for loop and there should be no reason to try to use one.  This is why I always use %item there... it is only used within the for loop and should be a local variable...

Thomas Nikolai Blekeli

unread,
Jun 2, 2013, 6:53:45 PM6/2/13
to tas...@googlegroups.com
Thank you so much, Bob and Rich D. You guys are the best. I've gone from a total silly noob to just noob (at least Thats what I like to believe) thanks to your patience and helpfulness. I'm reading the userguides and trying bits and bytes from others in this group, but the the help from you guys has been invaluable. Only hope I can return the favors somehow, someday.

I had to reinstall, stuff works again. I'll try your setup as soon as I can, Rich D :)

Rich D

unread,
Jun 2, 2013, 7:35:05 PM6/2/13
to tas...@googlegroups.com

> No matter what I do now, the For-action will not work.

OK, here is my best shot at explaining a 'for loop'....

Lets say we have an array with three items in it...

%array1 = red
%array2 = blue
%array3 = green

A for loop needs a comma separated list to function so if we do this..

Variable set %colors to %array()

This sets %colors to "red,blue,green"

So in the for loop action the first thing you set is the variable.  This is a local variable that will for each time through the loop equal a incrementally  different value from the list.. this is the one I always use %item for..

The next thing you set is the "Items"  this is your comma separated list this will be %colors

If we set the for loop like this..

A1. For ( variable: %item  /  Items: %colors )

A2. Flash %item

A3. Next

The loop will run 3 times because there are three Items in the list and it will flash ..

"red" then "blue" then "green"

Hope this helps..... Rich..

Thomas Nikolai Blekeli

unread,
Jun 3, 2013, 3:32:42 PM6/3/13
to tas...@googlegroups.com
Thanks yet, again, Bob and Rich D. I've tried several different ways to try the task to recognize if it's been run earlier and if so, do not copy earlier files. But it's not easy. I don't quite understand what you wrote, Rich D regarding how I should not write to file but just use a set variable instead.. I think I have used my quota here now, but if you guys are interested in trying to help a hopeless noob some more, heres my new code (had to uninstall tasker, so I figured I'd might as well start from scratch):


CopyToDB (4)
A1: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A2: For [ Variable:%item Items:%list() ]
A3: Flash [ Text:%item Long:Off ]
A4: Copy File [ From:%item To:dropsynctest Use Root:Off ]
A5: End For
A6: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]

Rich D

unread,
Jun 3, 2013, 4:59:37 PM6/3/13
to tas...@googlegroups.com

Sorry, after rereading I realize it was not very clear... lets try it this way..

> CopyToDB (4)
+ A1: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename*]
> A2: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
> A3: For [ Variable:%item Items:%list() ]
> A4: Flash [ Text:%item Long:Off ]
+ A5: If. %Filesmoved  does not match *,%item,*
> A6: Copy File [ From:%item To:dropsynctest Use Root:Off ]
+ A7: Variable set:%Filesmoved To:%item, Append On
+ A8: End If
  A9: End For
> A10: Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]
>

Here are the changes that I made...

1.  Put the variable set action at action  A1.  Note that the Append parameter is set to OFF

2. Added a " If " action at action A5:

3.  Added a variable set to action A7:   Note the comma after the variable %item. So you should enter "%item," (no quotes) in the box and Append is on.

4. Added the action 'End If' at action A8:   

5. Renumbered all actions to accommodate new lines..

Hope that is a little clearer .... RICH..

Thomas Nikolai Blekeli

unread,
Jun 3, 2013, 5:58:29 PM6/3/13
to tas...@googlegroups.com
Wow, thats amazing, Thank you. But I can't get it to copy the files to dropsynctest-folder. Checked the log and no errors, and all the actions in between the "if" - "end if" is green. Weird.. I'm trying to try to comprehend the actions you placed and this is really exciting, even though I'm not fully grasping the whole task. Heres what I've done:

CopyToDBsmart (6)


A1: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename* ]
A2: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A3: For [ Variable:%item Items:%list() ]
A4: Flash [ Text:%item Long:Off ]

A5: If [ %Filesmoved !~ *,%item,* ]


A6: Copy File [ From:%item To:dropsynctest Use Root:Off ]

A7: Variable Set [ Name:%Filesmoved To:%item, Do Maths:Off Append:On ]

A8: End If
A9: End For

A10: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]

Rich D

unread,
Jun 3, 2013, 6:53:58 PM6/3/13
to tas...@googlegroups.com

> Wow, thats amazing, Thank you. But I can't get it to copy the files to dropsynctest-folder. Checked the log

Do you mean you checked the run log? Did it show actions A6 and A7 running or did it skip from A5 to A9 ?

Did the files copy to the dropsynctest-folder before you changed the code to my suggestions?

What is the value of %Filesmoved when you it in the variables tab ?

To be clear,  when you run the task it will flash all of the file names for today but it just does not copy them to dropsynctest-folder. Correct??


I'm trying to try to comprehend the actions you placed and this is really exciting, even though I'm not fully grasping the whole task. Heres what I've done:

It should append the file names of the copied files To the variable %Filesmoved.  So if you check the value of %Filemoved in the variables tab it should contain a comma separated list of all the files that were flashed when the task ran.  And it should only copy the file if the current file in %item does not match any of the file names is contained in %Filesmoved.

Rich..

Rich D

unread,
Jun 4, 2013, 4:42:33 AM6/4/13
to tas...@googlegroups.com

But I can't get it to copy the files to dropsynctest-folder.

I found the troublemaker...  The problem was the match string we were using *,%item,*  contained several " /  " symbols.  In tasker regular matching the " / " is a "or" symbol and can not be used as a match. I have made this mistake before when dealing with file names but forgot about it. It most likely could be fixed by using regex but I am not that familiar with regex ...

I Had to make the entire task task to figure out the problem so I have posted my working version below. 

My solution was to make another variable and replace the "/ " symbol with a " | " symbol for matching purposes....

Copy Pics (275)
A1: Perform Task [ Name:getFormattedDate Stop:Off Priority:10 Parameter 1 (%par1):%TIMES Parameter 2 (%par2):yyyy-mm-dd Return Value Variable:%Filename ]
A2: Flash X  [ Text:%Filename Long:Off ]
A3: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename* ]
A4: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A5: For [ Variable:%item Items:%list() ]
A6: Variable Set [ Name:%itemreplaced To:%item Do Maths:Off Append:Off ]
A7: Variable Search Replace [ Variable:%itemreplaced Search:/ Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With:| ]
A8: Flash [ Text:%itemreplaced Long:Off ]
A9: If [ %Filesmoved !~ *,%itemreplaced,* ]
A10: Flash [ Text:Moved Long:Off ]
A11: Copy File [ From:%item To:dropsynctest Use Root:Off
A12: Variable Set [ Name:%Filesmoved To:%itemreplaced, Do Maths:Off Append:On ]
A13: End If
A14: End For

That should "git r done" ....  let me how it works ....  Rich..

Thomas Nikolai Blekeli

unread,
Jun 4, 2013, 6:10:08 AM6/4/13
to tas...@googlegroups.com
Rich, I'm speechless.. This is so awesome, thank you so much. It works great, but it still copies earlier files if I have transferred i.e one image and then take a couple more. It transfers all of them one more time. But it's absolutely amazing what you have done. Thank you so much! I've learned so much from these couple of days and I think I have used up my quota, so I'll try my best to figure out how to not copy files thats already has been copied. Heres how i set up your code:


CopyToDBsmart (4)
A1: Perform Task [ Name:getFormattedDate Stop:Off Priority:10 Parameter 1 (%par1):%TIMES Parameter 2 (%par2):yyyymmdd Return Value Variable:%Filename ]
A2: Flash [ Text:%Filename Long:Off ]

A3: Variable Set [ Name:%Filesmoved To:, Do Maths:Off Append:Off ] If [ %Filesmoved !~ *%Filename* ]
A4: List Files [ Dir:DCIM/Camera Match:%Filename* Include Hidden Files:Off Variable:%list ]
A5: For [ Variable:%item Items:%list() ]
A6: Variable Set [ Name:%itemreplaced To:%item Do Maths:Off Append:Off ]
A7: Variable Search Replace [ Variable:%itemreplaced Search:/ Ignore Case:Off Multi-Line:On One Match Only:Off Store Matches In: Replace Matches:On Replace With:| ]
A8: Flash [ Text:%itemreplaced Long:Off ]
A9: If [ %Filesmoved !~ *,%itemreplaced,* ]

A10: Flash [ Text:moved Long:Off ]

A11: Copy File [ From:%item To:dropsynctest Use Root:Off ]

A12: Variable Set [ Name:%Filesmoved To:%itemreplaced Do Maths:Off Append:On ]

A13: End If
A14: End For

A15: [X] Dropsync [ Configuration:Sync Now Package:com.ttxapps.dropsync Name:Dropsync ]

Once again, Rich, thank you so much!

Rich D

unread,
Jun 4, 2013, 6:32:46 AM6/4/13
to tas...@googlegroups.com

> A12: Variable Set [ Name:%Filesmoved To:%itemreplaced Do Maths:Off Append:On ]

You missed a comma here...

It needs to be "%itemreplaced,"  no quotes.   

Thomas Nikolai Blekeli

unread,
Jun 4, 2013, 9:39:51 AM6/4/13
to tas...@googlegroups.com
You Sir, are my hero. It works flawlessly!! Thank you so much!! Can you PM me your adress so I can send you a small gift as thanks for the work you've done?
Reply all
Reply to author
Forward
0 new messages