Page 1 of 1
Zip files with files datetime
Posted: Wed Mar 18, 2015 4:26 pm
by Prolasis
hello i am having trouble getting my zipped file to use the files datetime instead of the current datetime. Example i have my zip filename to be 2014-08-1 not todays date. Any idea how i can leverage the date time variable from the files i pick
C:\{Year}-{MonthNo}-{Day}-{Hours}-{Minutes}-{ExtractFileName({Source_folder})}.zip
Thanks
Re: Zip files with files datetime
Posted: Wed Mar 18, 2015 4:41 pm
by Oleg
I'm afraid that I don't understand your goal correctly.
Clarify please: do you want to retrieve the date (or year, month and day) from the name of file?
Re: Zip files with files datetime
Posted: Wed Mar 18, 2015 5:24 pm
by Prolasis
Hi Yes, Lets say i zip a file from aug 2014. instead of putting the curernt date as the .zip file name i would want the aug date as the file name.
Re: Zip files with files datetime
Posted: Wed Mar 18, 2015 6:07 pm
by Oleg
You can do this by using regular expressions. It is shortest way.
See my example below
Save the text of the task into a file and use menu Task->Import to import the task into RoboTask
Code: Select all
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1144"
Hide=INTEGER|0
ID=INTEGER|766386622
LogOnAsUser=INTEGER|1
Name=STRING|"Parse file name YYYY-MM-DD.zip"
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
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Parse the file name as format"""
Params=FOLDER
[Actions\Action1\Params]
icon=STRING|"1"
msg0=STRING|"Parse the file name as format"
msg1=STRING|"YYYY-MM-DD.zip"
msg2=STRING|"-or-"
msg3=STRING|"YYYY-M-D.zip"
msgcount=STRING|"4"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action2]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action2\Params]
destvar=STRING|"FILENAME"
line0=STRING|"2014-08-1.zip"
line1=STRING|"2014-8-15.zip"
line2=STRING|"SumpleName.txt"
linecount=STRING|"3"
sourcetext=STRING|"1"
[Actions\Action3]
ActionID=STRING|"A_REGEXP_MATCH"
Enabled=INTEGER|-1
Name=STRING|"RegExp Match"
Params=FOLDER
[Actions\Action3\Params]
anchored=STRING|"0"
case=STRING|"0"
extended=STRING|"0"
line00000000=STRING|"{filename}"
linecount=STRING|"1"
multiline=STRING|"0"
noautocapture=STRING|"0"
pattern=STRING|"(?i)(\d{4})-(\d{1,2})-(\d{1,2})\.zip"
savesubexpression=STRING|"1"
singleline=STRING|"0"
subexpressionpos=STRING|"0"
subexpressionvar=STRING|"found"
ungreedy=STRING|"0"
useexternal=STRING|"0"
variable=STRING|"res"
[Actions\Action4]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{res}"
[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File name {filename}"""
Params=FOLDER
[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"File name {filename}"
msg2=STRING|"Year = {found(1)}"
msg3=STRING|"Month = {found(2)}"
msg4=STRING|"Day = {found(3)}"
msgcount=STRING|"5"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action6]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
[Actions\Action7]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Name {filename}"""
Params=FOLDER
[Actions\Action7\Params]
icon=STRING|"3"
msg0=STRING|"Name {filename}"
msg1=STRING|"has wrong format!!"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Re: Zip files with files datetime
Posted: Thu Mar 19, 2015 5:55 pm
by Prolasis
thanks Oleg ,
Ill check this out
Re: Zip files with files datetime
Posted: Thu May 14, 2015 5:20 pm
by Prolasis
Thanks it did work, but now i am trying to zip all my files in separate archives by the month. Example i have 100 files but they are dated from different months. I want to zip all files in june in one archive and rest of the months the same. Any idea
Thanks