1. Are you ready for the Galaxy S20? Here is everything we know so far!

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

Discussion in 'Android Apps & Games' started by XplosiV, Jan 14, 2013.

  1. XplosiV

    XplosiV Master X is Watching You
    Thread Starter

    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;



    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.

  2. tatootie67

    tatootie67 Member

    Wouldn't it be so much easier to use a file manager or USB than tasker??
  3. CodeMonkey

    CodeMonkey Guest

    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.
    electricpete and XplosiV like this.
  4. XplosiV

    XplosiV Master X is Watching You
    Thread Starter

    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.

    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.
  5. CodeMonkey

    CodeMonkey Guest

    Well I develop software for a living but I didn't fancy reinventing the wheel so went for the plugin solution :D
  6. userloser

    userloser Newbie

    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.
    XplosiV likes this.
  7. XplosiV

    XplosiV Master X is Watching You
    Thread Starter

    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.
  8. SUroot

    SUroot Extreme Android User

    I too use foldersync. I don't even use it as a tasker plugin. Stand alone is fine.

    I use cron and rsync on Linux though.
  9. Droidwalking

    Droidwalking Lurker

    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)

    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.
    codesplice and D-U-R-X like this.
  10. dogsnap

    dogsnap Lurker

    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)

    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)?


Tasker Forum


⚙No repetitive tasks for you, let your Android device handle it!⚙
Total Automation, From Settings to SMS. Here are only some
of the things you could do with Tasker. Its real power is the flexibility to combine contexts and tasks however you wish: https://tasker.joaoapps.com/exampleuses.htmlAutomations
Make your phone a true smart
phone! Why remember to change the volume every day when you leave home when your phone can do it for you? Automate stuff based on the app you're in
, the time of day
, your location
, your Wi-Fi network
, Received SMS or Calls
, the currently playing song
and many other (130+) states and events! Check out how easy it is to create an automation: https://www.youtube.com/watch?v=s6EAbLW5WSkActions
350+ actions allow you to truly customize your phone like never before! Send SMS, create notifications, change almost any system setting like Wifi Tether, Dark Mode, Always On Display, change any volume, control Do Not Disturb, open apps, file manipulation, control music playback, get your location... you get the idea. If you can think of it, Tasker can probably do it for you! Note: root is NOT (I repeat NOT) required for majority of the functions.
However, a few of the actions (like the Airplane Mode action and the Mobile Data action on some devices) require root. Regarding those few actions that do require root, this is because of Android security policies that developers cannot work around. ☑ Other Triggers
Manually trigger your actions via launcher shortcuts, quick setting tiles, widgets, long-pressing volume buttons, media buttons (like the ones on your BT headsets or headphones), Bixby button, Navigation Bar, Notificaitons and more! ☑ Join - Remote Tasker
Adding Join (https://play.google.com/store/apps/details?id=com.joaomgcd.join) to the mix will even allow you to trigger tasks from another Android device or PC! ☑ Scenes
Design your own UI and use it to display any info you want or trigger any task! ☑ App Creation
Create your own standalone apps to share or sell with the Tasker App Factory (https://play.google.com/store/apps/details?id=net.dinglisch.android.appfactory)! ☑ Developer Friendly
A lot of 3rd party developers already allow you to perform actions in their apps and listen to their events/states through Tasker! Check out a list of plugins https://tasker.joaoapps.com/pluginlist.html. You can also call most of the Web APIs from Tasker with the powerful HTTP Auth and HTTP Request actions! Check out an example https://youtu.be/yAt2D1XmgUI. ☑ 7 day trial - one time payment to unlock
Get it here: https://tasker.joaoapps.com/download.htmlUseful Links
Starter Guides: https://tasker.joaoapps.com/guides.html Pre-made projects: https://forum.joaoapps.com/index.php?resources/ Official Support Forumhttps://groups.google.com/forum/#!forum/tasker Community full of people willing to help: https://www.reddit.com/r/tasker/ It's not possible to fix problems reported via Play Store Comments so please use the "Report Issue To Developer" option in the app > Menu to do so. Note
: Tasker uses the BIND_DEVICE_ADMIN permission in order to provide the System Lock functionality

February 15, 2020
Last Updated

Share This Page