SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Problem with Findfilefirst

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Problem with Findfilefirst
Author Message
John Kreimer



Joined: 26 Sep 2005
Posts: 8

Post Problem with Findfilefirst Reply with quote

I modified one of your scripts to find a file mask.
Then I placed it over the findfilefirst command.
The mask is perfect for finding the file when I put it under dir in cmd.
It finds the file no problem. This means I can find the file,
It's there and the debugger shows I have the correct mask value.
But the statement findfilefirst or findfilenext never return a "True" bool.

Ps: The other problem is the - in the server names, How do I get them to run.

here is my code
// This is an example of "file change watch" job. Regular "file watch" job checks
// file presence only. In some situations, you may need to run a job only when
// a change occurs.

dim today, date
Dim buffer, string
Dim file_time, string
Dim file_date, string
Dim date_time, date
Dim buffer2, string
Dim buffer3, string
dim buffer4, string
dim fileinfo, string
dim filename_found, string
Dim no_change, boolean
Dim datenow, date
Dim File_name, string
Dim DRIVE_LETTER, string, "e$"
Dim found, boolean
Dim file_now, string
//Dim endb18, string
//Dim endb17, string
//Dim endb16, string
//Dim endb15, string
//Dim endb17, string
//Dim 'dev-endr01', string
//Dim 'qat-endr01', string
//Dim "dev-entbc01", string
//Dim "qat-entbc01", string
//Dim "qat-enetl01", string
//Dim enas13, string
//Dim enas14, string
//Dim enas15, string
//Dim enas16, string
//Dim enas17, string
//Dim enas18, string
//Dim enas20, string
//Dim enas23, string
dim yesterday, date

//drive map uncs its got to be with E$ dollar sign to fine the share
//set DRIVE_LETTER = "e$"
//%1
//set endb18 \\endb18\%DRIVE_LETTER%
//set endb17 \\endb17\%DRIVE_LETTER%
//set endb16 \\endb16\%DRIVE_LETTER%
//set endb15 \\endb15\%DRIVE_LETTER%
//set endb17 \\endb14\%DRIVE_LETTER%
//set dev-endr01\\Dev-endr01\%DRIVE_LETTER%
//set qat_endr01\\qat_endr01\%DRIVE_LETTER%
//set dev-entbc01\\dev-entbc01\%DRIVE_LETTER%
//set qat_entbc01\\qat_entbc01\%DRIVE_LETTER%
//set qat-enetl01\\qat-enetl01\%DRIVE_LETTER%
//set enas13 \\enas13\%DRIVE_LETTER%
//set enas14 \\enas14\%DRIVE_LETTER%
//set enas15 \\enas15\%DRIVE_LETTER%
//set enas16 \\enas16\%DRIVE_LETTER%
//set enas17 \\enas17\%DRIVE_LETTER%
//set enas18 \\enas18\%DRIVE_LETTER%
//set enas20 \\encs20\%DRIVE_LETTER%
//set enas23 \\enas23\%DRIVE_LETTER%
//today (date_time)
//dateadd ( date_time, -3, yesterday)

//format ( date_time, "yyyy-mm-dd", datenow)
//format ( yesterday, "yyyy-mm-dd", yesterday)

set buffer e:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-26
concat( buffer, *.zip, buffer3)
filefindfirst ("buffer3", filename_found , found)
filefindnext ("buffer3", filename_found , found)
exit
//if found=" true"
//else

//loopwhile ( found, Endloop)
///exit

//concat( buffer, datenow, buffer2)
//concat( buffer, *.zip, buffer3)
// Read parameter file into buffer
//filefindfirst ("%buffer3%", fileinfo1 , found)

"you can't cut out the output of the debugger"


Mon Sep 26, 2005 5:25 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Problem with Findfilefirst Reply with quote

I don't know which script you modified but there is a syntax error in virtually every non-commented line in your script. I suggest you start with reading "24x7 Job Automation Language Overview" topic in the on-line help and then move on to the "Syntax" topic. Please also check "Special ASCII characters" topic.

Here is a brief example for the FileFindFirst using your file mask

Dim file_name, string
Dim found, boolean

// Start file search
FileFindFirst( "e:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_2005-09-26\\*.*", file_name, found )

// do something with the result here...

Also take a llok at Dir, DirEx topics and other file handling procedures. In case if you need to insert datetime values dynamically check out how to use @T macro-parameter.
Example:

FileFindFirst( "e:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_@T"yyyy-mm-dd"\\*.*", file_name, found )

: I modified one of your scripts to find a file mask.
: Then I placed it over the findfilefirst command.
: The mask is perfect for finding the file when I put it under dir in cmd.
: It finds the file no problem. This means I can find the file,
: It's there and the debugger shows I have the correct mask value.
: But the statement findfilefirst or findfilenext never return a
: "True" bool.

: Ps: The other problem is the - in the server names, How do I get them to run.

: here is my code
: // This is an example of "file change watch" job. Regular
: "file watch" job checks
: // file presence only. In some situations, you may need to run a job only
: when
: // a change occurs.

: dim today, date
: Dim buffer, string
: Dim file_time, string
: Dim file_date, string
: Dim date_time, date
: Dim buffer2, string
: Dim buffer3, string
: dim buffer4, string
: dim fileinfo, string
: dim filename_found, string
: Dim no_change, boolean
: Dim datenow, date
: Dim File_name, string
: Dim DRIVE_LETTER, string, "e$"
: Dim found, boolean
: Dim file_now, string
: //Dim endb18, string
: //Dim endb17, string
: //Dim endb16, string
: //Dim endb15, string
: //Dim endb17, string
: //Dim 'dev-endr01', string
: //Dim 'qat-endr01', string
: //Dim "dev-entbc01", string
: //Dim "qat-entbc01", string
: //Dim "qat-enetl01", string
: //Dim enas13, string
: //Dim enas14, string
: //Dim enas15, string
: //Dim enas16, string
: //Dim enas17, string
: //Dim enas18, string
: //Dim enas20, string
: //Dim enas23, string
: dim yesterday, date

: //drive map uncs its got to be with E$ dollar sign to fine the share
: //set DRIVE_LETTER = "e$"
: //%1
: //set endb18 \\endb18\%DRIVE_LETTER%
: //set endb17 \\endb17\%DRIVE_LETTER%
: //set endb16 \\endb16\%DRIVE_LETTER%
: //set endb15 \\endb15\%DRIVE_LETTER%
: //set endb17 \\endb14\%DRIVE_LETTER%
: //set dev-endr01\\Dev-endr01\%DRIVE_LETTER%
: //set qat_endr01\\qat_endr01\%DRIVE_LETTER%
: //set dev-entbc01\\dev-entbc01\%DRIVE_LETTER%
: //set qat_entbc01\\qat_entbc01\%DRIVE_LETTER%
: //set qat-enetl01\\qat-enetl01\%DRIVE_LETTER%
: //set enas13 \\enas13\%DRIVE_LETTER%
: //set enas14 \\enas14\%DRIVE_LETTER%
: //set enas15 \\enas15\%DRIVE_LETTER%
: //set enas16 \\enas16\%DRIVE_LETTER%
: //set enas17 \\enas17\%DRIVE_LETTER%
: //set enas18 \\enas18\%DRIVE_LETTER%
: //set enas20 \\encs20\%DRIVE_LETTER%
: //set enas23 \\enas23\%DRIVE_LETTER%
: //today (date_time)
: //dateadd ( date_time, -3, yesterday)

: //format ( date_time, "yyyy-mm-dd", datenow)
: //format ( yesterday, "yyyy-mm-dd", yesterday)

: set buffer e:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-26
: concat( buffer, *.zip, buffer3)
: filefindfirst ("buffer3", filename_found , found)
: filefindnext ("buffer3", filename_found , found)
: exit
: //if found=" true"
: //else

: //loopwhile ( found, Endloop)
: ///exit

: //concat( buffer, datenow, buffer2)
: //concat( buffer, *.zip, buffer3)
: // Read parameter file into buffer
: //filefindfirst ("%buffer3%", fileinfo1 , found)

: "you can't cut out the output of the debugger"

Mon Sep 26, 2005 6:03 pm View user's profile Send private message
John Kreimer



Joined: 26 Sep 2005
Posts: 8

Post Re: Problem with Findfilefirst Reply with quote

: I don't know which script you modified but there is a syntax error in
: virtually every non-commented line in your script. I suggest you start
: with reading "24x7 Job Automation Language Overview" topic in
: the on-line help and then move on to the "Syntax" topic. Please
: also check "Special ASCII characters" topic.

: Here is a brief example for the FileFindFirst using your file mask

: Dim file_name, string
: Dim found, boolean

: // Start file search
: FileFindFirst(
: "e:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_2005-09-26\\*.*",
: file_name, found )

: // do something with the result here...

: Also take a llok at Dir, DirEx topics and other file handling procedures. In
: case if you need to insert datetime values dynamically check out how to
: use @T macro-parameter.
: Example: FileFindFirst(
: "e:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_@T"yyyy-mm-dd"\\*.*",
: file_name, found )

Tue Sep 27, 2005 8:11 am View user's profile Send private message
John Kreimer



Joined: 26 Sep 2005
Posts: 8

Post Re: Problem with Findfilefirst Reply with quote

OK
I made the modifications and made it simpler. I still doesn't work.

Dim file_name, string
Dim found, boolean

FileFindFirst ("e:\\apps\\oracle\\backup1\\prdoid01\\prdoid_@T"yyyy-mm-dd"*.zip", file_name, found )

if (found, end, problem)

problem:
// Page network administrator
MailSend( "24xxxxxxler", "24xxxxxler", "Joxn.Kxxmer@NMCxxo.com", "oracle file not found ", " The oracle backup was not found" )

end:
exit

Tue Sep 27, 2005 9:23 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Problem with Findfilefirst Reply with quote

What do you mean by "doesn't work?" Do you get an error? If yes, what it is? If not what do you expect to happen and you don't find it happening? Please also indicate the complete file name that you ae looking for as you see in DOS.

PS: The way the script is coded now is do nothing if the file is found and email alert it if it doesn't.

: OK
: I made the modifications and made it simpler. I still doesn't work.

: Dim file_name, string
: Dim found, boolean

: FileFindFirst
: ("e:\\apps\\oracle\\backup1\\prdoid01\\prdoid_@T"yyyy-mm-dd"*.zip",
: file_name, found )

: if (found, end, problem)

: problem: // Page network administrator
: MailSend( "24xxxxxxler", "24xxxxxler",
: "Joxn.Kxxmer@NMCxxo.com", "oracle file not found ",
: " The oracle backup was not found" )

: end: exit

Tue Sep 27, 2005 11:25 am View user's profile Send private message
John Kreimer



Joined: 26 Sep 2005
Posts: 8

Post Re: Problem with Findfilefirst Reply with quote

The file i am looking for is:

I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27-00-00.zip

the findfirstfile mask is:
I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27*.zip
The Error is
File_name = "cmd.ftp"
fould= "false"

I can Get a simple c:\file name to run but above seems to have a problem with the _ "underscore" in the file name.
and this is a mapped drive.

test

Tue Sep 27, 2005 1:35 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Problem with Findfilefirst Reply with quote

I don't think so.

Try this:

Dim temp, string
DirEx "I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27*.zip", temp
MessageBox temp

Run it and let us know what you get there.

: The file i am looking for is:
: I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27-00-00.zip

: the findfirstfile mask is:
: I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27*.zip
: The Error is
: File_name = "cmd.ftp"
: fould= "false"

: I can Get a simple c:\file name to run but above seems to have a problem with
: the _ "underscore" in the file name.
: and this is a mapped drive.

: test

Tue Sep 27, 2005 2:28 pm View user's profile Send private message
John Kreimer



Joined: 26 Sep 2005
Posts: 8

Post Re: Problem with Findfilefirst Reply with quote

DirEx "I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27*.zip",
This item works great. my problem is that I am generating it with a macro command @T

this is the direct code
// find file routine
// the macro is very sensitive don't change anything
// This is how the file is to look findfilefirst I:\apps\oracle\backup1\prdoid01\prdoid01_@T"YYYY-mm-dd"*.zip, file_name, found
Dim file_name, string
Dim found, boolean
//dim error, string, "Checking for backup on endb18 instance prdoid01 all OK"

findfilefirst i:\apps\oracle\backup1\prdoid01\prdoid01_@T"YYYY-mm-dd"*.zip, file_name, found
if (found, end, problem)

problem:
// Page network administrator
MailSend( "24xxxxxxler", "24xxxxxler", "Joxn.Kxxmer@NMCxxo.com", "oracle file not found ", " The Oracle backup on instance Prodoi01 was not found" )

end:
RaiseError error

-------

Currently I have tried the " quotes" around the file name. That doesn't work and with out the "double Quotes" then the I: drive letter is highlighted red.

and it dosen't find the file.

Tue Sep 27, 2005 3:11 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Problem with Findfilefirst Reply with quote

You keep ommiting double-quotes around string parameters, that's why the script doesn't work for you.

The correct syntax is
FindFileFirst "i:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_@T"YYYY-mm-dd"*.zip", file_name, found

: DirEx "I:\apps\oracle\backup1\prdoid01\prdoid01_2005-09-27*.zip",
: This item works great. my problem is that I am generating it with a macro
: command @T

: this is the direct code
: // find file routine
: // the macro is very sensitive don't change anything
: // This is how the file is to look findfilefirst
: I:\apps\oracle\backup1\prdoid01\prdoid01_@T"YYYY-mm-dd"*.zip,
: file_name, found
: Dim file_name, string
: Dim found, boolean
: //dim error, string, "Checking for backup on endb18 instance prdoid01
: all OK"

: findfilefirst
: i:\apps\oracle\backup1\prdoid01\prdoid01_@T"YYYY-mm-dd"*.zip,
: file_name, found
: if (found, end, problem)

: problem: // Page network administrator
: MailSend( "24xxxxxxler", "24xxxxxler",
: "Joxn.Kxxmer@NMCxxo.com", "oracle file not found ",
: " The Oracle backup on instance Prodoi01 was not found" )

: end: RaiseError error

: -------

: Currently I have tried the " quotes" around the file name. That
: doesn't work and with out the "double Quotes" then the I: drive
: letter is highlighted red.

: and it dosen't find the file.

Tue Sep 27, 2005 5:44 pm View user's profile Send private message
John Kreimer



Joined: 26 Sep 2005
Posts: 8

Post Re: Problem with Findfilefirst Reply with quote

I copied in the file you say and it errors out saying the keyword is missing.
PS: The real differance between your and my script is the double backslashes. I still don't under stand the syntax.
This is a simple example again

Dim file_name, string
Dim found, boolean
FindFileFirst "i:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_@T"YYYY-mm-dd"*.zip", file_name, found

if (found, end, problem)

problem:

==================
This is what get in the debugger

FindFileFirst "i:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_2005-09-27*.zip", file_name, found

Tue Sep 27, 2005 6:55 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Problem with Findfilefirst Reply with quote

Sorry, it is FileFindFirst instead of FindFileFirst

: I copied in the file you say and it errors out saying the keyword is missing.
: PS: The real differance between your and my script is the double backslashes.
: I still don't under stand the syntax.
: This is a simple example again

: Dim file_name, string
: Dim found, boolean
: FindFileFirst
: "i:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_@T"YYYY-mm-dd"*.zip",
: file_name, found

: if (found, end, problem)

: problem: ==================
: This is what get in the debugger

: FindFileFirst
: "i:\\apps\\oracle\\backup1\\prdoid01\\prdoid01_2005-09-27*.zip",
: file_name, found

Tue Sep 27, 2005 7:10 pm View user's profile Send private message
John



Joined: 27 May 2002
Posts: 19

Post Re: Problem with Findfilefirst Reply with quote

Thank you for all your help!
It works.
Is there a way to remove my name from your list?
thanks

Tue Sep 27, 2005 7:31 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7963

Post Re: Problem with Findfilefirst Reply with quote

Sure, click the Unsubscribe link on the telp of the left frame.

: Thank you for all your help!
: It works.
: Is there a way to remove my name from your list?
: thanks

Tue Sep 27, 2005 8:02 pm View user's profile Send private message
John



Joined: 27 May 2002
Posts: 19

Post Re: Problem with Findfilefirst Reply with quote

U was talking about the Support listing string?

I have one more followup question. about the string
what do the next step is to use it on directories names with spaces in them.

Like the folowing:

FindFileFirst "i:\\apps\\oracle oracle\\backup1\\prdoid01\\prdoid01_@T"YYYY-mm-dd"*.zip", file_name, found

The difference is that the file structure has a Directory name with spaces in it.

I did try this common sense approach:
FindFileFirst "i:\\apps\\"oracle oracle"\\backup1\\prdoid01\\prdoid01_@T"YYYY-mm-dd"*.zip", file_name, found
this doesn't work:

Wed Sep 28, 2005 11:03 am 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.