Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Checking if file exists
Topic Summary:
Created On: 05/22/2013 09:20 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 05/22/2013 09:20 AM
User is offline View Users Profile Print this message

Author Icon
RayHayward
Student (5-19 posts)

Posts: 18
Joined: 05/17/2013

Hi,

I am creating an automate process to trigger a script that will produce multiple files.  What function is the best way to check if the files have completed processing to move on to another step?

 05/22/2013 01:31 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Ray,
the Wait for File action has an option to wait until the file is no longer in use

-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 05/23/2013 07:49 AM
User is offline View Users Profile Print this message

Author Icon
RayHayward
Student (5-19 posts)

Posts: 18
Joined: 05/17/2013

Hi,

Thank you for getting back to me.  What I am trying to do is check for 8 files.  If they are ALL there, then I would like to send a succesful email, otherwise a failure email noting which files are not there.  But it would be great to also make sure the file is no longer in use.

Is there a way to create a nested IF statement for waiting for files?

Basically, I want to do something like this:

If File1 exists and File2 exists File3 exists File4 exists File5 exists File6 exists File7 exists File8 exists Then

Send successful email

else

Send failure email and log details with failure information (which file(s) fail to exist)

I am having trouble writing a If statement with "AND" in it as well.  For example it does not like:

Create a variable named "File1" with an inital value of "File1"

Create a variable named "File2" with an inital value of "File2"

If file "C:\*%File1%*.txt" AND "C:\*%File2%*.txt"  exists (must be newer than %DateAdd("h",-24,CStr(Now())%) then ...

Send email message "Success" to %emailGroup%"

Else

Send email message "Failure" to %emailGroup%"

Doing this I get and error. 

However, if I use one parameter (just If file "C:\*%File1%*.txt") it works fine.

Any advise would be greatly appreciated. =)

Thank you,

Ray

 

 

 

 05/23/2013 11:43 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Ray,
I suppose you have a list of the eight filenames (full or partial) you look for.

You can loop that list, and determine the status of each file, and create two separate lists : one of the existing files, and another one of the missing files.

When the loop is over, you can do whatever you need with each of those two output lists.

It is difficult giving you coherent advice without seeing what your task currently looks like.

-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 05/23/2013 02:17 PM
User is offline View Users Profile Print this message

Author Icon
RayHayward
Student (5-19 posts)

Posts: 18
Joined: 05/17/2013

Hi,

Thank you!  Will give that a shot.  =)

Also, should the Wait statement be within an If statement?  For example:

If file exists then

wait for file

else

fail

end if

 05/24/2013 01:32 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Ray,
in this case, the wait can be used to wait "for the file no longer being in use".
Of course if the file does not (yet) exist at all, the If will not find it, and the wait will not be run.

-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1060 guests browsing this forum, which makes a total of 1060 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog