How to Create A Task to Auto-Backup Tasker Data

976 views
Skip to first unread message

Zohar

unread,
Nov 4, 2014, 6:17:41 AM11/4/14
to tas...@googlegroups.com
Hi
 
 
I would like to create a Task, that when ran, it will backup my tasker data to some location on my phone(SD Card).
 
 
If I understand correctly, I only need to copy 1 file - userbackup.xml?
 
Does this file contain all those 3: Profiles, Tasks, Scenes?
 
Does it also contain my Settings?
 
 
Thank you
 

Sergio

unread,
Nov 4, 2014, 6:22:32 AM11/4/14
to tas...@googlegroups.com
can't you just use the "auto back up" setting in Tasker ? It will do exactly what you want.
manu/settings/misc tab

Zohar

unread,
Nov 4, 2014, 6:28:01 AM11/4/14
to tas...@googlegroups.com

On Tuesday, November 4, 2014 1:22:32 PM UTC+2, Sergio wrote:
can't you just use the "auto back up" setting in Tasker ? It will do exactly what you want.
manu/settings/misc tab
 
I want to copy the backup to a different folder, which from there it will be copied to outside of the phone..
 

Scott Miller

unread,
Nov 4, 2014, 6:39:55 AM11/4/14
to tas...@googlegroups.com
For starters, the userbackup.xml does not contain Tasker settings, although it has been discussed and may eventually be added. It does include you projects, profiles, tasks, etc.

To sync to another location, use something like Folder Sync or Synchronize Ultimate, both of which have Tasker plugins to enable you to control when the sync takes place.There are a few others. This topic has been discussed frequently throughout this forum. Search for Folder Sync, as it is a frequently suggested solution.

Scott

--
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.
For more options, visit https://groups.google.com/d/optout.

Sergio

unread,
Nov 4, 2014, 6:40:44 AM11/4/14
to tas...@googlegroups.com
create a task with action file / copy file

click on the lense to find the directory where your file is (on my S2 it is  /storage/sdcard0/tasker/userbackup.xml) and again click on the lense to select the directory (on my S2, /storage/extSdCard/.....) where you want to put the file. 

you should not need root for this

Zohar

unread,
Nov 4, 2014, 6:57:24 AM11/4/14
to tas...@googlegroups.com
Thank you all for all the tips.
 
OK so the settings are not included.
Are they in another file? (I will then backup 2 files instead of 1..)
 
 
1 more question please.
 
From what I see, the userbackup.xml file that is located in /storage/sdcard0/Tasker/ is not necessarily the most updated.
It is only updated if I manually do Menu:Data\Backup.
 
Is there a way to programatically request tasker to create a backup? (so it will update the /storage/sdcard0/Tasker/userbackup.xml file?)
 
 
(If not, then I will need to take the file from the /storage/sdcard0/Tasker/ folder)

Zohar

unread,
Nov 4, 2014, 6:58:44 AM11/4/14
to tas...@googlegroups.com
small fix to my last sentence:
 
(If not, then I will need to take the file from the /storage/sdcard0/Tasker/autobackups folder)

Scott Miller

unread,
Nov 4, 2014, 7:52:26 AM11/4/14
to tas...@googlegroups.com


> OK so the settings are not included.
> Are they in another file? (I will then backup 2 files instead of 1..)

Only if you have root access, but it's not recommended.

> From what I see, the userbackup.xml file that is located in /storage/sdcard0/Tasker/ is not necessarily the most updated.
> It is only updated if I manually do Menu:Data\Backup.
>  

Correct.

> Is there a way to programatically request tasker to create a backup? (so it will update the /storage/sdcard0/Tasker/userbackup.xml file?)
>  

Menu - Preferences - Misc - Maximum Autobackup Age

It gets created every time you exit the UI after making changes.

Zohar

unread,
Nov 4, 2014, 8:05:58 AM11/4/14
to tas...@googlegroups.com
Thank youv ery much Scott.
 
OK now the last thing left to do is this:
 
Since the most updated userbackup.xml file is going to be in the /storage/sdcard0/Tasker/autobackups/ folder,
then I will take it from there.
 
The thing is, that everu backup in the automackups folder, is placed inside its own folder,
and the folder name is composed from the date in which the change happened.
 
 
So now I need, to programatically get the folder name, of the folder containing the latest backup.
 
 
How do I do it?
 

Scott Miller

unread,
Nov 4, 2014, 8:47:16 AM11/4/14
to tas...@googlegroups.com

As I already mentioned, look at Folder Sync.

https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.full

Scott

Zohar

unread,
Nov 4, 2014, 10:33:09 AM11/4/14
to tas...@googlegroups.com
Oh
 
But I don't want to do it with FolderSync,
I want to do it with Tasker..
 
So I need to get the name of the folder with the latest date,
and then, I will copy the userbackup.xml file from that folder to my target folder, and then continue from there..
 
If anyone can direct me how to get the foldername it will be great..

Matt R

unread,
Nov 4, 2014, 3:02:10 PM11/4/14
to tas...@googlegroups.com
I don't remember the format of the folder names, but the list files action performed on the autobackups folder will give you an array with all the folder names.  I'm not sure if array sort would work or if you'll have to do a for loop to check each folder name to see if it's the latest in time.

Matt

Zohar

unread,
Nov 4, 2014, 3:09:51 PM11/4/14
to tas...@googlegroups.com
The folder names are like this:
 
20141104.15.31.12-20141104.15.35.38
 
 
When I try to use the List Files action, it gives me nothing.
Maybe because the List Files action can only show files, not folders?

Matt R

unread,
Nov 4, 2014, 3:19:18 PM11/4/14
to tas...@googlegroups.com
No, it should list folders as well.  Verify that you picked the right folder to run the list files action on, and that there are items in that folder.

Matt

Zohar

unread,
Nov 5, 2014, 1:34:44 AM11/5/14
to tas...@googlegroups.com
On Tuesday, November 4, 2014 10:19:18 PM UTC+2, Matt R wrote:
No, it should list folders as well.  Verify that you picked the right folder to run the list files action on, and that there are items in that folder.
You're correct,
I had a problem with the variable..
 
I was putting the result in a variable called %ListFiles, and then tried to Flash %ListFiles, instead of %ListFiles1/%ListFiles2/etc
Apparently %ListFiles doesn't get filled, only the %ListFiles1/2/3/etc ones.
 
 
OK,
The List Files action lists the items(files+folders) sorted alphabetically.
It is good here, since the folder name is composed from the Date and Time.
 
So now %ListFiles1 is the oldest backup..
I need to get to the last %ListFiles..
Is that possible?

Zohar

unread,
Nov 5, 2014, 1:50:31 AM11/5/14
to tas...@googlegroups.com
small addition:
I found how to get the array's last element's index:
%arr(#<)
 
 
will now experiment with it

Zohar

unread,
Nov 5, 2014, 2:09:16 AM11/5/14
to tas...@googlegroups.com
OK
 
For simplicity, %arr(<) can be used, which directly gives the value of the last array element.
 
So %arr(<) now holds the correct Folder Name.
 
I now need to concatenate a "/userbackup.xml" to it.
 
How can I do it?

Matt R

unread,
Nov 5, 2014, 3:01:57 AM11/5/14
to tas...@googlegroups.com
Use variable set.

Matt

Zohar

unread,
Nov 5, 2014, 3:54:48 AM11/5/14
to tas...@googlegroups.com
Great!
 
I used Variable Set, with the Append=true checkbox.
 
 
It's working :)
 
 
BTW, Tasker has the JavaScriptlet action,
so for learning sake, I tried doing it there too.
 
The array variable is called %listfiles,
and in JavaScript, this expression did the same:
listfiles[listfiles.length-1]+"/userbackup.xml"
 
 
It's very nice that Tasker has the JavaScript/let actions, for code that is easier to perform in JavaScript..
 
 
 
Reply all
Reply to author
Forward
0 new messages