FileTime only returning date + time once

Discuss RoboTask here
Post Reply
pancakegh
Posts: 15
Joined: Mon Feb 16, 2015 10:21 am

FileTime only returning date + time once

Post by pancakegh »

Hello,

I have a folder where I export pdf's to. I need to filter for files that are newer than X seconds. The only filter I can apply with a file loop is the filter for newer than X minutes. I am trying to get the current seconds and the file seconds inside the loop but I can't seem to figure how to convert them to seconds.

Also, the first file is returning a correct date + time, but the files after that are not returning the time part, see attached.

Here is the task:

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task13"
Hide=INTEGER|0
ID=INTEGER|-1526632036
LogOnAsUser=INTEGER|1
Name=STRING|"Auto upload pdf to ftp zelfde bestand"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

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

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

[Actions\Action1\Params]
createmode=STRING|"7"
createormodified=STRING|"1"
date1=STRING|"20200526"
date2=STRING|"20200526"
destvar=STRING|"UPLOAD"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"50"
DuringMonths=STRING|"1"
file0=STRING|"P:\DATASLUIS\D_Product administratie\D2 Product layouts\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
savevar=STRING|"GROOTTE"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FILETIME"" with value ""{FileTime({UPLOAD})}"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"FILETIME"
varvalue=STRING|"{FileTime({UPLOAD})}"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""CURRENTTIME"" with value ""{DateTime}"""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"CURRENTTIME"
varvalue=STRING|"{DateTime}"

[Actions\Action4]
ActionID=STRING|"A_FTP_LOGON"
Enabled=INTEGER|0
Name=STRING|"FTP Log On"
Params=FOLDER

[Actions\Action4\Params]
anonymous=STRING|"0"
host=STRING|"ftp.oranjefurniturecare.com"
passive=STRING|"0"
password=STRING|"3257737291395912473432618"
port=STRING|"21"
proxykind=STRING|"0"
useproxy=STRING|"0"
username=STRING|"oranjefurniturecarecom@oranjefurniturecarecom"

[Actions\Action5]
ActionID=STRING|"A_FTP_UPLOAD"
Enabled=INTEGER|0
Name=STRING|"FTP Upload"
Params=FOLDER

[Actions\Action5\Params]
file=STRING|"{UPLOAD}"
folder=STRING|"subsites/designnummers.oranjefurniturecare.com/lijst/pdf"

[Actions\Action6]
ActionID=STRING|"A_FTP_LOGOFF"
Enabled=INTEGER|0
Name=STRING|"FTP Log Off"

[Actions\Action7]
ActionID=STRING|"A_ROBOTASK_ALERT"
Enabled=INTEGER|-1
Name=STRING|"Show Notification"
Params=FOLDER

[Actions\Action7\Params]
defh=STRING|"1"
defw=STRING|"1"
duration=STRING|"3"
height=STRING|"76"
icon=STRING|"3"
kind=STRING|"0"
message=STRING|"File time = {filetime}"
position=STRING|"3"
title=STRING|"Current time = {CURRENTTIME}"
width=STRING|"330"

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Params=FOLDER
UniqueID=INTEGER|-183007220

[Events\Event1\Params]
chg=STRING|"1"
chga=STRING|"0"
chglist=STRING|"I:\Backups\changedtemplist.txt"
chglistparameter=STRING|"newtext"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"0"
chgtm=STRING|"0"
del=STRING|"0"
folder1=STRING|"P:\DATASLUIS\D_Product administratie\D2 Product layouts"
foldercount=STRING|"1"
incmask=STRING|"*.*"
interval=STRING|"5"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
newlist=STRING|"I:\Backups\newtemplist.txt"
newlistparameter=STRING|"newtext"
onelist=STRING|"C:\Windows\Temp\templist.txt"
onelistparameter=STRING|"newfile"
pass=STRING|"0"
passmode=STRING|"1"
required=STRING|"1"
saveresults=STRING|"0"
subfolders1=STRING|"0"

How do I check if a file is newer than X seconds?
Attachments
filetime.png
filetime.png (21.78 KiB) Viewed 3540 times
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: FileTime only returning date + time once

Post by Oleg »

Look at my example
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1163085779
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task190"
Hide=INTEGER|0
ID=INTEGER|-1818670532
LogOnAsUser=INTEGER|1
Name=STRING|"Auto upload pdf to ftp zelfde bestand (2 ver)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""CURRENTTIME"" with value ""{DateTime}"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"1"
varkind=STRING|"1"
varname=STRING|"CURRENTTIME"
varvalue=STRING|"{DateTime}"

[Actions\Action10]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action11]
ActionID=STRING|"A_ROBOTASK_ALERT"
Enabled=INTEGER|-1
Name=STRING|"Show Notification"
Params=FOLDER

[Actions\Action11\Params]
defh=STRING|"1"
defw=STRING|"1"
duration=STRING|"3"
height=STRING|"76"
icon=STRING|"3"
kind=STRING|"0"
message=STRING|"File time = {filetime}"
position=STRING|"3"
title=STRING|"Current time = {CURRENTTIME}"
width=STRING|"330"

[Actions\Action12]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""MAXDELTA"" with value ""90"""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varname=STRING|"MAXDELTA"
varvalue=STRING|"90"

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

[Actions\Action3\Params]
createmode=STRING|"7"
createormodified=STRING|"1"
date1=STRING|"20200526"
date2=STRING|"20200526"
destvar=STRING|"UPLOAD"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"50"
DuringMonths=STRING|"1"
file0=STRING|"P:\DATASLUIS\D_Product administratie\D2 Product layouts\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
savevar=STRING|"GROOTTE"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"1"
timevar=STRING|"FILETIME"
WithoutPath=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_TIMEDIFFERENCE"
Enabled=INTEGER|-1
Name=STRING|"Time Difference"
Params=FOLDER

[Actions\Action4\Params]
datetime1=STRING|"{FileTime}"
datetime2=STRING|"{CurrentTime}"
format=STRING|"0"
valuekind=STRING|"0"
varname=STRING|"delta"

[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"4"
type=STRING|"1"
value1=STRING|"{delta}"
value2=STRING|"{MaxDelta}"

[Actions\Action6]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//do something"
Params=FOLDER

[Actions\Action6\Params]
comment=STRING|"do something"

[Actions\Action7]
ActionID=STRING|"A_FTP_LOGON"
Enabled=INTEGER|0
Name=STRING|"FTP Log On"
Params=FOLDER

[Actions\Action7\Params]
anonymous=STRING|"0"
host=STRING|"ftp.oranjefurniturecare.com"
passive=STRING|"0"
password=STRING|"3257737291395912473432618"
port=STRING|"21"
proxykind=STRING|"0"
useproxy=STRING|"0"
username=STRING|"oranjefurniturecarecom@oranjefurniturecarecom"

[Actions\Action8]
ActionID=STRING|"A_FTP_UPLOAD"
Enabled=INTEGER|0
Name=STRING|"FTP Upload"
Params=FOLDER

[Actions\Action8\Params]
file=STRING|"{UPLOAD}"
folder=STRING|"subsites/designnummers.oranjefurniturecare.com/lijst/pdf"

[Actions\Action9]
ActionID=STRING|"A_FTP_LOGOFF"
Enabled=INTEGER|0
Name=STRING|"FTP Log Off"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Name=STRING|"File Monitor"
Params=FOLDER
UniqueID=INTEGER|1665025884

[Events\Event1\Params]
chg=STRING|"1"
chga=STRING|"0"
chglist=STRING|"I:\Backups\changedtemplist.txt"
chglistparameter=STRING|"newtext"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"0"
chgtm=STRING|"0"
del=STRING|"0"
folder1=STRING|"P:\DATASLUIS\D_Product administratie\D2 Product layouts"
foldercount=STRING|"1"
incmask=STRING|"*.*"
interval=STRING|"5"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
newlist=STRING|"I:\Backups\newtemplist.txt"
newlistparameter=STRING|"newtext"
onelist=STRING|"C:\Windows\Temp\templist.txt"
onelistparameter=STRING|"newfile"
pass=STRING|"0"
passmode=STRING|"1"
required=STRING|"1"
saveresults=STRING|"0"
subfolders1=STRING|"0"

But I see on your screenshot that FileTime returns only date part for file time
Maybe disk P is some network drive and system returns only date part of full time.
Usually FileTime returns full time with date and time (hh:mm:ss)
Oleg Yershov
Post Reply