Trying to move photos from WhatsApp to external SD

1,202 views
Skip to first unread message

DazH

unread,
Feb 9, 2015, 12:24:17 AM2/9/15
to tas...@googlegroups.com
Hi there everyone

I'm new to Android and Tasker,  trying to move photos from my WhatsApp media folder (internal) to my external SD. I followed this tutorial http://youtu.be/h86EZcdOlVk pretty much exactly) but I get an error message on stage 4 saying "Error: Move: File not found storage/emulated/0/%Files()."

My source folder location (according to details in Gallery) is storage/emulated/0/WhatsApp/Media.WhatsAppImages/ and my destination is storage/sdcard1/DCIM/100ANDRO

I've attached a screenshot of what I've done ion Tasker - can anyone shed any light on what's going wrong?

Thanks!


Screenshot_2015-02-09-13-17-38.png

Rich D

unread,
Feb 9, 2015, 1:01:54 AM2/9/15
to Tasker Google Groups Post


> I've attached a screenshot of what I've done ion Tasker - can anyone shed any light on what's going wrong?

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

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).

DazH

unread,
Feb 9, 2015, 2:13:36 AM2/9/15
to tas...@googlegroups.com
Thanks for the reply. Here's the task

MoveFiles (5)
A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*. jog Include Hidden Files:Off Use Root:Off Variable:%files ]
A2: Flash [ Text:Moving files Long:Off ]
A3: For [ Variable:%file Items:%files () ]
A4: Move [ From:%file To:/storage/sdcard1/DCIM/100ANDRO Use Root:Off ]
A5: End For
















Rich D

unread,
Feb 9, 2015, 3:36:10 AM2/9/15
to Tasker Google Groups Post

> Thanks for the reply. Here's the task

2 issues...

1- You have a space in your %files () .  It should be %files() in action A3

>
> MoveFiles (5)
>         A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*. jog Include Hidden Files:Off Use Root:Off Variable:%files ]
>         A2: Flash [ Text:Moving files Long:Off ]

///////
Here..

>         A3: For [ Variable:%file Items:%files () ]

////////


>         A4: Move [ From:%file To:/storage/sdcard1/DCIM/100ANDRO Use Root:Off ]
>         A5: End For
>
>
>

2- from the user guide.. 

Move

Move an SD card file or directory to a new directory.

If To specifies an existing file, it will be overwritten.

The paths start in the root directory of the SD card.

//////////

Note: files cannot be moved from one file system to another e.g. internal memory to SD. A workaround is to Copy and then Delete.

///////////

DazH

unread,
Feb 9, 2015, 7:16:36 AM2/9/15
to tas...@googlegroups.com
That is awesome knowledge, thanks so much -  a lot to take in there.

I actually found an example of a copy/delete task workflow-thing (new to Tasker so still struggling). which I have replicated and which I think will do what I want. Not got the thing to actually work yet, I'll post the task here later when I understand a bit better how this all works.

Again, thanks for the help, I think I'm on the right path.

Odysseos

unread,
Feb 9, 2015, 11:58:54 AM2/9/15
to tas...@googlegroups.com
Hello. All you have to do is to add two actions to your for loop:
1) Copy files action
2) Delete files action.
So your task should be like this

Whatsupimg (25)
A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*.jpg* Include Hidden Files:Off Use Root:Off Variable:%Whupfiles ]
A2: For [ Variable:%Whupfiles Items:%Whupfiles() ]
A3: Copy File [ From:%Whupfiles To:/storage/extSdCard/WhappCopy Use Root:On ]
A4: Flash [ Text:%Whupfiles Long:Off ]
A5: Delete File [ File:%Whupfiles Shred Level:0 Use Root:On ]
A6: End For

Also, I noticed in the pic that you posted in A3 you have " For variable %file items %files ()" where it should be : "For variable %files items %files()"
Again, in A1 you have "...Match:*.jog" instead of "...Match:*.jpg*"

DazH

unread,
Feb 10, 2015, 2:43:56 AM2/10/15
to tas...@googlegroups.com
Hi All

Odysseos (or anyone else who reads this): I tried to follow your instructions but noticed that in your code 'Root' is on. I haven't rooted my phone - is this necessary to move the files as I've described in my OP?

Cheers

Rich D

unread,
Feb 10, 2015, 8:23:21 AM2/10/15
to Tasker Google Groups Post


> Odysseos (or anyone else who reads this): I tried to follow your instructions but noticed that in your code 'Root' is on. I haven't rooted my phone - is this necessary to move the files as I've described in my OP?
>

Afaik,  Root is not required for this.   Is it not working for you?  The only one thing i would change would be the match. I think * means something has to be there, so I would change the match in the files list action  to *.jpg

Rich D

unread,
Feb 10, 2015, 8:32:24 AM2/10/15
to Tasker Google Groups Post

Oh, one more thing. There is no reason to use a global variables in this task. It will slow thing down and leave you with a global array you do not need.  I would go back to the local variables you used in your original task.  

If you are still having problems, post what you have so far.

DazH

unread,
Feb 10, 2015, 7:43:14 PM2/10/15
to tas...@googlegroups.com
Thaqnks again for the replies.

What I have so far is this, with the error occuring as a red dot in stage A3 but no pop-up with an explanation. Also, the scrren capture looks a bit werid with stuff getting 'embedded', not sure if that's how it's supposed to be.

Apologies for the noobness and again, thanks for the input.

CooyDelete (6)
A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*. jpg Include Hidden Files:Off Use Root:Off Variable:%Whupfiles ] 


A2: For [ Variable:%Whupfiles Items:%Whupfiles() ] 

A3: Copy File [ From:%Whupfiles To:/storage/sdcard1/DCIM/100ANDRO Use Root:Off ] 


A4: Flash [ Text:%Whupfiles Long:Off ] 

A5: Delete File [ File:%Whupfiles Shred Level:0 Use Root:Off ] 
A6: End For 

Screenshot_2015-02-11-08-41-13.png

Rich D

unread,
Feb 10, 2015, 8:28:56 PM2/10/15
to Tasker Google Groups Post


You need to pay attention to the extra white spaces. It is most likely your chosen keyboard putting them in.

Your match in A1  has a extra space.   *. Jpg. Should be *.jpg

You should also use local variables. Like the ones in your first profile.  A local variable only has lowercase letters. A global variable has one or more capitol letters. They are explained in the user guide.

You will want to copy your pics and save them with a file browser until you confirm this works as expected.  It should work fine but you want to always be carful when using the delete files action.

I would recommend disabling the delete file action untill you make sure the copy files work as well. To disable a action, Long click on the action / disable

Here is a edited version
>
> CooyDelete (6)
> A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*.jpg Include Hidden Files:Off Use Root:Off.Variable:%files ] 
>
> A2: For [ Variable:%file Items:%files() ] 
> A3: Copy File [ From:%file To:/storage/sdcard1/DCIM/100ANDRO Use Root:Off ] 
>
> A4: Flash [ Text:%file Long:Off ] 
> A5: Delete File [ File:%file Shred Level:0 Use Root:Off ] 
> A6: End For 
>

DazH

unread,
Feb 17, 2015, 8:44:18 PM2/17/15
to tas...@googlegroups.com

Hello Rich D, Hi all

Completely missed this message.

OK, started from scratch with a new task, still doesn't work, still getting a red dot on A3 with no pop-up explanation. Have checked my code, cannot see anything wrong.

Appreciate all the help. Starting to think it's not actually possible to do what I want with Tasker and WhatsApp...... 

My Code:

Photomove (7)
A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*.jpg Include Hidden Files:Off Use Root:Off Variable:%files ] 
A2: For [ Variable:%file Items:%files() ] 
A3: Copy File [ From:%file To:/storage/sdcard1/DCIM/100ANDRO Use Root:Off ] 
A4: Flash [ Text:%file Long:Off ] 
A5: Delete File [ File:%file Shred Level:0 Use Root:Off ] 
A6: End For 


Any forthcoming help still very welcome.

Rich D

unread,
Feb 17, 2015, 9:18:44 PM2/17/15
to Tasker Google Groups Post


> OK, started from scratch with a new task, still doesn't work, still getting a red dot on A3 with no pop-up explanation. Have checked my code, cannot see anything wrong.

To get a pop up error you need to enable them in the tasker preferences.  You will only see these errors when you re-enter the tasker UI after the error has occurred. This is the best way to find issues with file operations. 

>
> Appreciate all the help. Starting to think it's not actually possible to do what I want with Tasker and WhatsApp...... 

Nahh...  this should be easy. 

Try flashing %files()  just after A1

Make sure "


> OK, started from scratch with a new task, still doesn't work, still getting a red dot on A3 with no pop-up explanation. Have checked my code, cannot see anything wrong.

To get a pop up error you need to enable them in the tasker preferences.  You will only see these errors when you re-enter the tasker UI after the error has occurred. This is the best way to find issues with file operations. 

>
> Appreciate all the help. Starting to think it's not actually possible to do what I want with Tasker and WhatsApp...... 

Nahh...  this should be easy. 

Try flashing %files()  just after A1

Make sure " /storage/sdcard1/DCIM/100ANDRO " is the correct path.

Make sure you are backing all the way out of tasker with the back button after making changes.

How are you starting this task?

DazH

unread,
Feb 17, 2015, 9:47:50 PM2/17/15
to tas...@googlegroups.com
Thanks Rich

OK, added a flash as A2, it correctly listed the files that are in the internal folder.

"/storage/sdcard1/DCIM/100ANDRO" is the path I chose as it's the location where the photos are stored from the camera, as shown by looking at the file path within Album according to details.

To start the task I select it (so that all the stages are showing within Tasker) and then click on the 'play' icon at the bottom of the screen. Is this not right?

Screenshot shows how it looks after a failed run, code below. Cheers!

hotomove (7)
A1: List Files [ Dir:WhatsApp/Media/WhatsApp Images Match:*.jpg Include Hidden Files:Off Use Root:Off Variable:%files ] 
A2: Flash [ Text:%files() Long:Off ] 
A3: For [ Variable:%file Items:%files() ] 
A4: Copy File [ From:%file To:/storage/sdcard1/DCIM/100ANDRO Use Root:Off ] 
A5: Flash [ Text:%file Long:Off ] 
A6: Delete File [ File:%file Shred Level:0 Use Root:Off ] 
A7: End For 
Screenshot_2015-02-18-10-40-15.png

Rich D

unread,
Feb 17, 2015, 10:49:08 PM2/17/15
to Tasker Google Groups Post


> "/storage/sdcard1/DCIM/100ANDRO" is the path I chose as it's the location where the photos are stored from the camera, as shown by looking at the file path within Album according to details.

If you have not done so already, use the mag glass in the copy file action to select the receiving folder.

Did you enable 'pop up errors' in the tasker preferences?

DazH

unread,
Feb 17, 2015, 11:03:31 PM2/17/15
to tas...@googlegroups.com
Yes, used the mag glass and have enabled pop-ups. Curiously, the pop up shows up a bit later, after Ive exited the app. 

Please look at the attached log, mentions permissions being denied at various stages.
Screenshot_2015-02-18-11-58-30.png

Scott Miller

unread,
Feb 17, 2015, 11:15:46 PM2/17/15
to tas...@googlegroups.com

What version of Android? I didn't see that mentioned. In KitKat, Google has added restrictions preventing apps from writing to folders on the external sdcard that are not owned by that app. This can be overcome with root access. In lollipop it has been changed again, making it a bit easier, but still different than earlier versions of Android.

Scott

DazH

unread,
Feb 17, 2015, 11:31:26 PM2/17/15
to tas...@googlegroups.com
Thanks Scott. I'm on a Sony Z3 with 4.4.4 and apparently Lollipop any day now.

Hmm. Are you saying that I currently would need to root the phone first? And maybe in the future with Lollipop root wouldn't be necessary? If that were the case I'd wait for Lollipop and if not then just root it.

anon ymous

unread,
Feb 18, 2015, 1:59:01 AM2/18/15
to tas...@googlegroups.com
Just a heads up: from what I've been reading it seems currently the only way to toggle mobile data on lollipop requires root access; worth keeping in mind if you use tasker or anything else to turn mobile data on/off.

Odysseos

unread,
Feb 18, 2015, 2:00:33 AM2/18/15
to tas...@googlegroups.com

Hello Dahz, please give a look to the pic below:

Scott Miller

unread,
Feb 18, 2015, 5:46:24 AM2/18/15
to tas...@googlegroups.com

Change your target path to point to your internal sdcard instead of external, and see if it works. At least you can validate your task.

There is a way to write to external storage without root, but it can be cumbersome. If you create Tasker's private folder, you should be able to write to that. But I think it either needs to exist before installing Tasker, or Tasker needs to create it, which you might be able to do with another task. I'm not certain of the exact path, but it would need to be something like /storage/sdcard1/Android/data/net.dinglisch.android.tasker. Do a Google search about writing to external storage in KitKat and you should find some information about it.

You can also try to make Tasker a system app, but that would also need root, and comes with its own share of problems. System apps are able to write to external storage without restriction.

Once you get to lollipop, you will need to grant permission to Tasker to write to external storage, then it should work. At least that's how I understand it. I'm not there yet, so I don't have specific experience about it.

One last comment. It might be easier to root your phone on KitKat than it will be on lollipop, but I don't know your device. You would need to do some research about that on your own.

Scott

On Feb 17, 2015 11:31 PM, "DazH" <darren...@gmail.com> wrote:
Thanks Scott. I'm on a Sony Z3 with 4.4.4 and apparently Lollipop any day now.

Hmm. Are you saying that I currently would need to root the phone first?  And maybe in the future with Lollipop root wouldn't be necessary? If that were the case I'd wait for Lollipop and if not then just root it.

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

DazH

unread,
Feb 18, 2015, 10:26:53 AM2/18/15
to tas...@googlegroups.com
Thanks for that. As it happens (see below) the syntax actually works, the problem is trying to write to an external card.

DazH

unread,
Feb 18, 2015, 10:29:39 AM2/18/15
to tas...@googlegroups.com
Yea, thanks a lot for the full answer again, much appreciated.

Much appreciated Rich and the others for the code too.

I  created a new folder on the internal storage and validated the task. So it's a problem with KitKat and not being able to write to an external SD Card - unless somebody can step in with differing information. 

Let's hope that L actually does change this for the better,
Reply all
Reply to author
Forward
0 new messages