organize pictures

Discuss RoboTask here
Post Reply
okty2k
Posts: 3
Joined: Fri May 15, 2015 12:43 pm

organize pictures

Post by okty2k »

i am trying to create the followig task:
prerequisites: lots of pictures in one folder
target: move pictures based on creation date on a folder (for example - all pictures taken on 1st of march in a folder named March01)
steps:
of course, this is my idea, somebody can have a better one
1. make a list with file names (this i know)
2. for each file, get creation date (is it possible with robotask?) and move it to a folder based on day and month. if the folder does not exist, create it

can anyone help?
big thanks in advance!
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: organize pictures

Post by Oleg »

Yes, of course this is possible.
See the example below:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task87"
Hide=INTEGER|0
ID=INTEGER|777979452
LogOnAsUser=INTEGER|1
Name=STRING|"organize pictures"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""SRCFOLDER"" with value ""C:\source"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"SRCFOLDER"
varvalue=STRING|"C:\source"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""DESTFOLDER"" with value ""C:\catalog"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"DESTFOLDER"
varvalue=STRING|"C:\catalog"

[Actions\Action3]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action3\Params]
createmode=STRING|"1"
date1=STRING|"20160315"
date2=STRING|"20160315"
destvar=STRING|"C_PICTURE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"{srcFolder}\*.jpg"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"1"
timevar=STRING|"PICT_DT"
WithoutPath=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FLD"" with value ""{DateTimeToFormat({Pict_DT},yyyy-mm-dd)}"""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"1"
varname=STRING|"FLD"
varvalue=STRING|"{DateTimeToFormat({Pict_DT},yyyy-mm-dd)}"

[Actions\Action5]
ActionID=STRING|"A_FOLDER_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create Folder ({DestFolder}\{fld})"
Params=FOLDER

[Actions\Action5\Params]
newfolder=STRING|"{DestFolder}\{fld}"

[Actions\Action6]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER

[Actions\Action6\Params]
destdir=STRING|"{DestFolder}\{fld}"
f_count=STRING|"1"
file0=STRING|"{c_Picture}"
hidden=STRING|"1"
ifexists=STRING|"1"
move=STRING|"0"
rename=STRING|"0"
renamemask=STRING|"*.*.new"
subdir=STRING|"0"
system=STRING|"1"

[Actions\Action7]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
If you want to move file (delete source file) just switch on "Move" checkbox in the step #7

Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Oleg Yershov
okty2k
Posts: 3
Joined: Fri May 15, 2015 12:43 pm

Re: organize pictures

Post by okty2k »

Great, thanks!
Would it be possible to create folder for months having the name instead of the number? From what I saw in Variable description it is not, just wanted to check
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: organize pictures

Post by Oleg »

Of course this is possible, use the expression
{DateTimeToFormat({Pict_DT},yyyy-mmmm-dd)}
in the step #4

See the complete list of system variables here: http://robotask.com/help/index.php?listofvariables.htm

Also you can see variables by categories in dialog: menu Options->Variables

This example is very simple. You can organize your files into any folder structure, but the algorithm will be more complex.
The format of the date "yyyy-mm-dd" is a very comfortable because you automatically sort your folders on years, months and days.
Oleg Yershov
okty2k
Posts: 3
Joined: Fri May 15, 2015 12:43 pm

Re: organize pictures

Post by okty2k »

Thanks, but my question still remains: I want the month to be text (January) and not the number 01.
I tried defining arreys, etc, but I am not expert and is not working. :)

SORRY, JUST SAW THAT I CAN PUT -MMMM- to get the name
MMMM for month name is not present in the variable list.
Post Reply