SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Date Checking

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Date Checking
Author Message
dave



Joined: 16 Jun 2003
Posts: 41

Post Date Checking Reply with quote

Hi,
I need to have JAL or VB Script do the following in the scheduler.

What I am doing is running a .exe. This .exe outputs files (excel) to a specific directory.

After a hours or so I have another job run that does a XCopy to another directory.

The problem is that if the date of the outputted files do NOT match the
current date the XCopy should NOT run as the data in the report is not correct.

So I can do it two ways:
1) Run a script before the Xcopy that checks the system date and matches it with the date of the
outputted files. If they do not match DO NOT do the xcopy. Instead send a email to me stating that
the files are outdated.

or

2) After XCopy completed delete all the excel files from that directory.

I need help. :-)

As always thanks for yourhelp.

Wed Mar 02, 2005 12:07 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7974

Post Re: Date Checking Reply with quote

What you need is FileDir command line utility. You can find it in the 24x7 Tips and Scripts archive. This utility can be used to process "aged" files, in you case files having "1 day" age.

If you really want to email for every "older" file then you would need to write a script type job to loop through all files and based on the file date process it or send an email.

Here is a modified JAL example copied from the on-line help

Dim( found_files, string )
Dim( is_empty, boolean, FALSE )
Dim( file_name, string )
Dim( file_date, date )
Dim( today, date )
Dim( fresh_file, boolean )
Dim( count, number )

Today( today )
DirEx( "k:\\web\\new\\*.htm", found_files )
IsEqual( found_files, "", is_empty )

// loop and process file by file
LoopUntil( is_empty, END_LOOP )

GetToken( ",", found_files, file_name )

// Get File date and compare it
FileDate( file_name, file_date )
IsEqual( file_date, today, fresh_file )

// Process file if fresh or send email if not
IfThen( fresh_file, DO_COPY )
MailSend( "me@mysite.com", "password", "Old file found by job @V"job_name"", file_name )
GoTo AFTER_COPY

DO_COPY:
FileCopyEx( file_name, "k:\\some_destination", count )
AFTER_COPY:

// check if there is more files in the list
IsEqual( found_files, "", is_empty )

END_LOOP:

: Hi,
: I need to have JAL or VB Script do the following in the scheduler.

: What I am doing is running a .exe. This .exe outputs files (excel) to a
: specific directory.

: After a hours or so I have another job run that does a XCopy to another
: directory.

: The problem is that if the date of the outputted files do NOT match the
: current date the XCopy should NOT run as the data in the report is not
: correct.

: So I can do it two ways: 1) Run a script before the Xcopy that checks the
: system date and matches it with the date of the
: outputted files. If they do not match DO NOT do the xcopy. Instead send a
: email to me stating that
: the files are outdated.

: or

: 2) After XCopy completed delete all the excel files from that directory.

: I need help. :-)

: As always thanks for yourhelp.

Wed Mar 02, 2005 12:44 pm View user's profile Send private message
dave



Joined: 16 Jun 2003
Posts: 41

Post Re: Date Checking Reply with quote

OK thats seesma bit compliacted. Is there a way to simply delete every .xls file in a directory using JAL?

: What you need is FileDir command line utility. You can find it in the 24x7
: Tips and Scripts archive. This utility can be used to process
: "aged" files, in you case files having "1 day" age.

: If you really want to email for every "older" file then you would
: need to write a script type job to loop through all files and based on the
: file date process it or send an email.

: Here is a modified JAL example copied from the on-line help

: Dim( found_files, string )
: Dim( is_empty, boolean, FALSE )
: Dim( file_name, string )
: Dim( file_date, date )
: Dim( today, date )
: Dim( fresh_file, boolean )
: Dim( count, number )

: Today( today )
: DirEx( "k:\\web\\new\\*.htm", found_files )
: IsEqual( found_files, "", is_empty )

: // loop and process file by file
: LoopUntil( is_empty, END_LOOP )

: GetToken( ",", found_files, file_name )

: // Get File date and compare it
: FileDate( file_name, file_date )
: IsEqual( file_date, today, fresh_file )

: // Process file if fresh or send email if not
: IfThen( fresh_file, DO_COPY )
: MailSend( "me@mysite.com", "password", "Old file
: found by job @V"job_name"", file_name )
: GoTo AFTER_COPY

: DO_COPY: FileCopyEx( file_name, "k:\\some_destination", count )
: AFTER_COPY: // check if there is more files in the list
: IsEqual( found_files, "", is_empty )

: END_LOOP:

Wed Mar 02, 2005 4:56 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7974

Post Re: Date Checking Reply with quote

Dim( count, number )
FileDeleteEx( "c:\\dir\\subdir\\*.xls", count )

: OK thats seesma bit compliacted. Is there a way to simply delete every .xls
: file in a directory using JAL?

Wed Mar 02, 2005 5:17 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.