I'm wondering if it's possible to add a line to create
file list that includes the date the file was created or
modified.
For example, current output is
1.txt
2.txt
3.txt
And the ideal output would be
1.txt 12/26/2011
2.txt 12/25/2011
3.txt 12/20/2011
Thanks,
Leslie
Create file list- include file date?
Create file list- include file date?
See the example below. This task makes the list of TXT files from c:\incoming folder with date in your current format
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1134"
Hide=INTEGER|0
ID=INTEGER|1867208249
LocalVariables=STRING|"cfile,newtext,filetime"
LogOnAsUser=INTEGER|1
Name=STRING|"List of files with file date"
OnErrorTaskID=INTEGER|0
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
[Actions\Action1]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//with date in your format"
Params=FOLDER
[Actions\Action1\Params]
comment=STRING|"with date in your format"
[Actions\Action2]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action2\Params]
createmode=STRING|"1"
date1=STRING|"20111227"
date2=STRING|"20111227"
destvar=STRING|"CFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\incoming\*.txt"
filecount=STRING|"2"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"1"
timevar=STRING|"FILETIME"
WithoutPath=STRING|"1"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_DELIMITED"
Enabled=INTEGER|-1
Name=STRING|"Delimit Variable"
Params=FOLDER
[Actions\Action3\Params]
colon=STRING|"0"
comma=STRING|"0"
other=STRING|"0"
quote=STRING|"0"
semocolon=STRING|"0"
space=STRING|"1"
spaceasone=STRING|"0"
string=STRING|"{filetime}"
tab=STRING|"0"
variable=STRING|"filetime"
[Actions\Action4]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NEWTEXT"" with value ""{newtext}{cfile} {filetime(0)}{EOL}"""
Params=FOLDER
[Actions\Action4\Params]
expand=STRING|"1"
varname=STRING|"NEWTEXT"
varvalue=STRING|"{newtext}{cfile} {filetime(0)}{EOL}"
[Actions\Action5]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action6]
ActionID=STRING|"A_FOLDER_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create Folder (c:\temp)"
Params=FOLDER
[Actions\Action6\Params]
newfolder=STRING|"c:\temp"
[Actions\Action7]
ActionID=STRING|"A_FILE_TEXTWRITE"
Enabled=INTEGER|-1
Name=STRING|"Create text file c:\temp\list.txt"
Params=FOLDER
[Actions\Action7\Params]
fileexists=STRING|"0"
filname=STRING|"c:\temp\list.txt"
line0=STRING|"{newtext}"
linecount=STRING|"1"
suppress=STRING|"1"
[Actions\Action8]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""list.txt """
Params=FOLDER
[Actions\Action8\Params]
ifnonzero=STRING|"0"
program=STRING|"c:\temp\list.txt"
runas=STRING|"0"
wait=STRING|"0"
Create file list- include file date?
This is perfect, thank you!
Create file list- include file date?
Would it be possible to change the format of the date?
I've
looked at the filetime variable, and I don't see an
obvious
way to do it..
Ideally, I'd like the date format to be something like
YYMMDD, however I have no idea how to do this
edit:
Actually, I think I figured something out from looking at
samples. Downloaded the basic plug-in and put an extra
step in the task you posted above to evaluate & added an
extra local variable in
Please let me know if there is a better way to do this,
otherwise I will stick with this solution
I've
looked at the filetime variable, and I don't see an
obvious
way to do it..
Ideally, I'd like the date format to be something like
YYMMDD, however I have no idea how to do this
edit:
Actually, I think I figured something out from looking at
samples. Downloaded the basic plug-in and put an extra
step in the task you posted above to evaluate & added an
extra local variable in
Code: Select all
[Actions\Action4]
ActionID=STRING|"BASIC_EVALUATE"
Enabled=INTEGER|-1
Name=STRING|"Evaluate"
Params=FOLDER
[Actions\Action4\Params]
expression=STRING|"format(#{filetime(0)}#, ""yymmdd"")"
variable=STRING|"FORMATTEDDATE"
[Actions\Action5]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""NEWTEXT"" with value ""
{newtext}{formatteddate}{cfile}{EOL}"""
Params=FOLDER
[Actions\Action5\Params]
expand=STRING|"1"
varname=STRING|"NEWTEXT"
varvalue=STRING|"{newtext}{formatteddate}{cfile}{EOL}"
otherwise I will stick with this solution
Last edited by minor on Thu Dec 29, 2011 11:23 pm, edited 1 time in total.
Create file list- include file date?
You have forestalled me .
I want to say that you can do complex string transformation with actions of Basic plugin (Evaluate or Basic Script)
I want to say that you can do complex string transformation with actions of Basic plugin (Evaluate or Basic Script)