• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

[Solved] Tasker - File Copy (not so fun)

XplosiV

Master X is Watching You
Jun 10, 2010
5,422
1,972
UK
xplosiv.getmyip.com
So after having suffered from the S3's little nand memory eppy fit and corrupting, I figured if get tasker and see if I can set up some kind of backup thingy-mo-jiggy.

Alas it seems pretty much impossible for me, so can anyone help? A click by click - step by step would be much appreciated.

The aim:

Copy files from one directory to another. Namely along the lines of;

From
/storage/sdcard0/dcim/

To
/storage/extsdcard/backup

The files could be .jpg or .jpeg so do I also need to set up variables so both will copy?

Much thanks, hope someone can help before I go completely insane.
 
I do something along these lines but using a third party app to do the grunt work, Foldersync.

My profile fires at 5am each morning if the phone is in my "sleep" mode and connected to my home WiFi.
It pings my server, wakes it up if it does not respond (using another third party plugin) and then fires a Foldersync profile to backup my phone files to a designated user area on the server. A notification alert is then left on the phone to indicate success / failure and launch Foldersync if pressed.
 
Upvote 0
Wouldn't it be so much easier to use a file manager or USB than tasker??

I could as I'm paid up with root explorer, but the whole point of tasker was to make it automated or done via a widget.

I do something along these lines but using a third party app to do the grunt work, Foldersync.

My profile fires at 5am each morning if the phone is in my "sleep" mode and connected to my home WiFi.
It pings my server, wakes it up if it does not respond (using another third party plugin) and then fires a Foldersync profile to backup my phone files to a designated user area on the server. A notification alert is then left on the phone to indicate success / failure and launch Foldersync if pressed.

Yeah, that sounds good, maybe a little more for what I need. What's really frustrating is its all but one line of code in MS-DOS so you'd think something can be scripted to do the same in Android. Tasker just makes a meal out of it for code n00bs which is unfortunate, and the help fan's are next to useless.
 
Upvote 0
Yeah, that sounds good, maybe a little more for what I need. What's really frustrating is its all but one line of code in MS-DOS so you'd think something can be scripted to do the same in Android. Tasker just makes a meal out of it for code n00bs which is unfortunate, and the help fan's are next to useless.

Well I develop software for a living but I didn't fancy reinventing the wheel so went for the plugin solution :D
 
Upvote 0
try the rsync tasker plugin. it is not complicated if you know how to use rsync and ssh, and it is the handiest backup solution I've used on android.

basically I dump the backups in some predetermined folders on the phone/tablet, and then when titanium backup fires a notification for completed weekly backup, tasker rsyncs everything to the home file server. setting up a context that responds to specific notifications is easy.

the only minor problem is that the plugin doesn't seem to recognize tasker variables, so you're limited to one backup path per task.
 
  • Like
Reactions: XplosiV
Upvote 0
I finally got it sorted.

Apparently my line of thinking was too complex. Maybe partly due to some examples I'd seen referencing specifying specific file extensions.

Anyhow. To answer my own question. Here is a quick how to:

With File Magic installed (not sure if it's used but hey)
Open tasker.
Create a profile.
Specify TIME
input desired time (00:30) for FROM
tick repeat
Untick TO

This will run the TASK until it's competed.

Now tap TASKS
Add new
Select file
Select COPY DIR
Tap the magnifying glass to the right of FROM
Tap the bottom right arrow to go to the list of drives
Select drive (in my case sdcard0)
Select folder DCIM by LONG PRESSING
Tap the magnifying glass to the right of TO
Tap the bottom right arrow to go to the list of drives
Select drive (in my case extsdcard)
Select folder BACKUP by LONG PRESSING
Tap the green tick.

Rinse and repeat for any other folders you want, changing the source folders as needed.

My backup takes about 4-5 min's to complete but it copies all files within source directories to the external sd card into the folder Backup. No root required (unless you want to backup root required files)

Thanks for your help guys and girls.
 
Upvote 0
I understand this was already solved. However, I found a stand-alone Tasker method to accomplish the same thing, so for anyone looking, try this:

I wanted a way to back up my camera pictures, contact files (lost too many contacts because of "trial" address books and of course, ALL my Tasker settings (tasks, profiles, scripts, etc). Since Foldersync doesn't always work for me, I prefer to move files around myself to my different storage areas. This allows me to do that at my convenience.

Since each is contained in it's own folder, I don't have a huge list of files that I don't know what they are / do. Don't delete the back-up folder, just move the contents inside. I found that to be a lot faster...but you can easily modify this to fit your needs.


Profile: Saturday back-up
From 00:00 - 00:02 (can be changed to fit your needs / phone speed)
+
Saturday

Task: Saturday back-up
Create directory
Dir back-up/contacts
Run Shell
Command sh /shcard/tasker/scripts/backup.sh
Copy dir
From Tasker/
To back-up/Tasker
Copy dir
From DCIM/Camera
To back-up


And the backup script
backup.sh (can be created using any text file editor
mv /sdcard/contact*.vcf /sdcard/back-up/Contacts


Automatically runs once a week. Very convenient for me without a lot of extra programs clogging up my phone and draining the battery.
 
Upvote 0
I understand this was already solved. However, I found a stand-alone Tasker method to accomplish the same thing, so for anyone looking, try this:

I wanted a way to back up my camera pictures, contact files (lost too many contacts because of "trial" address books and of course, ALL my Tasker settings (tasks, profiles, scripts, etc). Since Foldersync doesn't always work for me, I prefer to move files around myself to my different storage areas. This allows me to do that at my convenience.

Since each is contained in it's own folder, I don't have a huge list of files that I don't know what they are / do. Don't delete the back-up folder, just move the contents inside. I found that to be a lot faster...but you can easily modify this to fit your needs.


Profile: Saturday back-up
From 00:00 - 00:02 (can be changed to fit your needs / phone speed)
+
Saturday

Task: Saturday back-up
Create directory
Dir back-up/contacts
Run Shell
Command sh /shcard/tasker/scripts/backup.sh
Copy dir
From Tasker/
To back-up/Tasker
Copy dir
From DCIM/Camera
To back-up


And the backup script
backup.sh (can be created using any text file editor
mv /sdcard/contact*.vcf /sdcard/back-up/Contacts


Automatically runs once a week. Very convenient for me without a lot of extra programs clogging up my phone and draining the battery.


hi, the fact that Tasker, an app priding itself on offering flexibility did not provide much flexibility, itself, within it's backup function is ironic. having to install yet another application (which will also need to be backed up) is ridiculous, imho. so i've been wanting an elegant solution to backing up all the wayward backward directories in internal storage to sd.

I think i like your solution, however I'm not understanding the nitty gritty tech stuff, so if u r still active on this board, I have a few questions for u if u don't mind.

before the questions, I will just say that if your stated solution requires rooting, i won't need answers since I'm not comfortable rooting.

thanks in advance!

1. >> /shcard/tasker/scripts/backups <<

is this line of code correct? did u mean to write /shcard, or did u mean /sdcard?

2. I seem to read it as the first part being the part you setup within tasker (profile/task):

>>
Profile: Saturday back-up
From 00:00 - 00:02 (can be changed to fit your needs / phone speed)
+
Saturday

Task: Saturday back-up
Create directory
Dir back-up/contacts
Run Shell
Command sh /shcard/tasker/scripts/backups <<

and the second part being the wording in the script:

>> Copy dir
From Tasker/
To back-up/Tasker
Copy dir
From DCIM/Camera
To back-up <<

I am assuming you simply left off the last part of the camera backup path (should be "To back-up/DCIM")?

but then the third part of your post is confusing me... you write:

>> And the backup script
backup.sh (can be created using any text file editor
mv /sdcard/contact*.vcf /sdcard/back-up/Contacts <<


is this the backup script, and the other part j thought was the backup script is really done from within a tasker task? or is it is a second script?

3. you reference COPYING the backup files for both Tasker and Photos, but then MOVING the contacts files (i'm assuming "mv" means MOVE). am I mistaken in my assumption or is there a specific reason for this difference?

4. the tasker part of your solution seems to call for creating directories. normally, I would expect a backup solution where I would initially create the backup directories (one for each app) myself and then the backup solution would simply automate copying the files each week to those respective directories.
why does your solution call for creation of directories each time, and what does the folder structure end up being after the solution has run like 3 weeks in a row, since it seems to call for the same directory names being created each time?

wouldn't it error-out because there is already a directory with the same name, or does it automatically create another directory of the same name, but with a "(2)" or "(3)" or "(4)" after it?

5. I assume, since this example references 3 different backups, this solution can handle even more backups at once. i.e. I can backup multiple apps by simply adding and calling extra tasks within the one tasker profile (one profile just seems waay simpler to me). am I correct in this assumption, or do u think there's a limit to how many tasks or scripts can be called from one tasker profile (practically speaking, so as to not crash the system)?
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones