Move Files & Timestamp Each

438 views
Skip to first unread message

aritafari

unread,
Sep 17, 2012, 12:52:56 PM9/17/12
to tas...@googlegroups.com
I have a task that moves all files ending in .mobi from the "Download" to the "Kindle" directory. Works fine.
For example: If Wall Street Journal.mobi & The Economist.mobi are moved, how do stamp each with date/time?

I tried renaming: Kindle/The Wall Street Journal [%DATE] [%TIME]. But it also (as one would expect) renamed The Economist to WSJ.

So you say why don't I just download to the Kindle directory to begin with? I AM TRYING TO AVOID OVERWRITES if I am late in reading the day's paper.
What should I put after Kindle/ to capture and stamp both files?
Thanks.

Pent

unread,
Sep 17, 2012, 3:06:28 PM9/17/12
to Tasker
For example:

File / List Files, Download, *.mobil, -> %files
Task / For %file, %files
Misc / Test, File Name, %file, -> %filename
File / Move File, %file, Kindle/%filename.%DATE.%TIME

Pent

aritafari

unread,
Sep 17, 2012, 3:56:21 PM9/17/12
to tas...@googlegroups.com
Brilliant Pent!

Worked perfectly. Mucho Gracias

Yan Lin

unread,
May 4, 2013, 5:36:07 AM5/4/13
to tas...@googlegroups.com
Hello,

Sorry for piggybacking this thread.
I found my situation is quite the same that aritafari had.
My goal is however, to upload Tasker's automatic backup profile (which is saved under timestamped folder) into my google drive.
But, I want to upload only the xml file only, and named the file with %time and %date.
I've entered the all steps that pent pointed out above.

Here's my profile:
File attribute change: /storage/sdcard0/Tasker/autobackups/
Action: I called it Folder Extract
1. List file -> Dir: Tasker/autobackups/; Match: *.xml; Variable: %file
2. Tasker for -> Variable: %file, items: %files
 3. Misc Test -> Type Filename; Data: %file; Store result in %filename
 4. Move -> From: Tasker/autobackups/%files; To: Tasker/Upload/%filename.%Date
5 End for

Now, I got error:
Test: File not found: /storage/sdcard0/%files.

Something I did wrong? Please enlighten me...
Thx

Matt R

unread,
May 4, 2013, 11:50:14 PM5/4/13
to tas...@googlegroups.com
Action 1 should be %files instead of %file. Action 4 should be from %file instead of Tasker/autobackup/%files.

Matt

Yulianto Pranoto

unread,
May 5, 2013, 3:54:14 AM5/5/13
to tas...@googlegroups.com
Thx Matt,

I changed mine with yours. But, unfortunately... the problem still exist.




On Sun, May 5, 2013 at 10:50 AM, Matt R <matthew.r...@gmail.com> wrote:
Action 1 should be %files instead of %file. Action 4 should be from %file instead of Tasker/autobackup/%files.

Matt

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/j9dpU0ySDEs/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Matt R

unread,
May 5, 2013, 1:19:09 PM5/5/13
to tas...@googlegroups.com
Can you export the relevant profile(s)/task(s)? Long-press a profile or task name and select export -> description to clipboard and paste in a reply here.

Matt

Yulianto Pranoto

unread,
May 6, 2013, 5:43:33 AM5/6/13
to tas...@googlegroups.com

Hi matt,
Here's my action file

<TaskerData sr="" dvi="1" tv="4.0u1m">
<Task sr="task17">
<cdate>1367645399257</cdate>
<edate>1367660318718</edate>
<id>17</id>
<nme>Seperate From Folder</nme>
<pri>10</pri>
<Action sr="act0" ve="3">
<code>412</code>
<Str sr="arg0" ve="3">Tasker/autobackups/</Str>
<Str sr="arg1" ve="3">*.xml</Str>
<Int sr="arg2" val="0"/>
<Str sr="arg3" ve="3">%file</Str>
</Action>
<Action sr="act1" ve="3">
<code>39</code>
<Str sr="arg0" ve="3">%file</Str>
<Str sr="arg1" ve="3">%files</Str>
</Action>
<Action sr="act2" ve="3">
<code>115</code>
<Int sr="arg0" val="2"/>
<Str sr="arg1" ve="3">%file</Str>
<Str sr="arg2" ve="3">%filename</Str>
</Action>
<Action sr="act3" ve="3">
<code>400</code>
<Str sr="arg0" ve="3">Tasker/autobackups/%files</Str>
<Str sr="arg1" ve="3">Tasker/Upload/%filename.%DATE.</Str>
<Int sr="arg2" val="0"/>
</Action>
<Action sr="act4" ve="3">
<code>40</code>
</Action>
</Task>
</TaskerData>

Thank you

On May 6, 2013 12:19 AM, "Matt R" <matthew.r...@gmail.com> wrote:
Can you export the relevant profile(s)/task(s)? Long-press a profile or task name and select export -> description to clipboard and paste in a reply here.

Matt

Matt R

unread,
May 6, 2013, 4:44:28 PM5/6/13
to tas...@googlegroups.com
Please export the DESCRIPTION, not XML.

Matt

Yulianto Pranoto

unread,
May 6, 2013, 7:59:09 PM5/6/13
to tas...@googlegroups.com

Sorry Matt...
Here it is...

Seperate From Folder (17)
A1: List Files [ Dir:Tasker/autobackups/ Match:*.xml Include Hidden Files:Off Variable:%file ]
A2: For [ Variable:%file Items:%files ]
A3: Test [ Type:File Name Data:%file Store Result In:%filename ]
A4: Move [ From:Tasker/autobackups/%files To:Tasker/Upload/%filename.%DATE. Use Root:Off ]
A5: End For

On May 7, 2013 3:44 AM, "Matt R" <matthew.r...@gmail.com> wrote:
Please export the DESCRIPTION, not XML.

Matt

--

Matt R

unread,
May 6, 2013, 8:11:41 PM5/6/13
to tas...@googlegroups.com
It doesn't look like you made the changes I suggested in my first post.

Matt

Yulianto Pranoto

unread,
May 6, 2013, 8:22:57 PM5/6/13
to tas...@googlegroups.com

Hello Matt,

Looks like I am not a good student, am I? Hahaha...
Well, I did change the steps that you pointed out yesterday... But still error comes out like this:
Test: file not found:/storage/sdcard0/%files instead of %file

Oh... This is bugging me as well... Does the phone need yo be rooted?
Sorry for the silly question.

Thank you

On May 7, 2013 7:11 AM, "Matt R" <matthew.r...@gmail.com> wrote:
It doesn't look like you made the changes I suggested in my first post.

Matt

Yulianto Pranoto

unread,
May 6, 2013, 8:23:55 PM5/6/13
to tas...@googlegroups.com

Seperate From Folder (17)
A1: List Files [ Dir:Tasker/autobackups/ Match:*.xml Include Hidden Files:Off Variable:%files ]

A2: For [ Variable:%file Items:%files ]
A3: Test [ Type:File Name Data:%file Store Result In:%filename ]

A4: Move [ From:%file To:Tasker/Upload/%filename.%DATE. Use Root:Off ]
A5: End For

Bob Hansen

unread,
May 6, 2013, 8:45:55 PM5/6/13
to tas...@googlegroups.com
I think the reason for the error message is because there are no .xml files in the directory. Tasker creates a new folder in this directory for each new backup. The .xml files are in these subfolders. The subfolder names consist of the date and time. Inside each of these folders is one file named userbackup.xml. Since there are no xml files found the %file never has a value and that leads to the error message.

Yulianto Pranoto

unread,
May 6, 2013, 8:51:38 PM5/6/13
to tas...@googlegroups.com

Yes Bob,
Correct me if I'm wrong...
I use list file to show all xml files in the sub dir.
I tried to copy one of the xml file into the parent which is autobackups.
The problem still exists.

Thank you

On May 7, 2013 7:46 AM, "Bob Hansen" <rghan...@gmail.com> wrote:
I think the reason for the error message is because there are no .xml files in the directory. Tasker creates a new folder in this directory for each new backup. The .xml files are in these subfolders. The subfolder names consist of the date and time. Inside each of these folders is one file named userbackup.xml. Since there are no xml files found the %file never has a value and that leads to the error message.

Bob Hansen

unread,
May 6, 2013, 10:15:01 PM5/6/13
to tas...@googlegroups.com
How can something that should be so easy be causing this much frustration!

I created a new task that only has the List Files action.
I only had the path defined and left the match option blank.
This will return the paths to all the subdirectories each one as a variable %File1, %File2, etc.

I copied a userbackup.xml into the Tasker/autobackup directory.
Next I added a match condition for auto*
When the task is executed, it returns one file - the one in the autobackup directory.
It does not include any from subdirectories.

I then went back and set up the your first action to match mine. When run it generates an error, but that error is coming from the third action. 

This still needs some work. I would suggest that you build this one step at a time.
I suggest changing the variable names to start with a capital letter so you can check there values under the Var tab.

I will continue to help as best as I can. 
Please clarify for me exactly what is supposed to happen. What is the A3" Test action for?

Bob Hansen

unread,
May 7, 2013, 12:04:31 AM5/7/13
to tas...@googlegroups.com
After some more checking, here is a partially working version. It no longer throws errors :>)
I created some new variables. I corrected the For loop. Changed the move action to a copy action because you can't rename a file as part of the move. 
 
I ended up installing File Magic (plugin for Tasker that aids in file management).

The problem left to solve now is deal with the subfolders. That's why I want to know exactly what you require. If you use File Magic you can copy entire folders. If that works for you, that is the easiest way to handle them.

Seperate From Folder (12)
A1: List Files [ Dir:Tasker/autobackups Match:user* Include Hidden 
Files:Off Variable:%File ]
A2: For [ Variable:%Thisitem Items:%File() ]
A3: Variable Set [ Name:%Newfilename 
To:/storage/sdcard0/Tasker/Upload/userbackup.xml.%DATE Do Maths:Off 
Append:Off ]
A4: Copy File [ From:%Thisitem To:%Newfilename Use Root:Off ]
A5: End For
Reply all
Reply to author
Forward
0 new messages