Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Issue with FileExists, executing del command, and ReadAll

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59770
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Issue with FileExists, executing del command, and ReadAll
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Issue with FileExists, executing del command, and ReadAll - 5/3/2008 4:43:44 AM   
  vbscoded

 

Posts: 3
Score: 0
Joined: 5/2/2008
Status: offline
well, i've been at this quite awhile and i can't figure out what's wrong. i need a script that does the following:

1. assign and ip address to a new ups by doing the following
  a. send arp request to nic for new ups
     i. verify arp request was successful with regular expression
  b. send ping request with specific packet size to nic for new ups
     i. verify ping request was successful with regular expression
2. download ups configuration file using ftp
  a. verify ups configuration file downloaded successfully by checking log file
3. create a new temp configuration file
4. open downloaded configuration file for reading, and write contents into temp configuration
  file along with standard configuration settings
5. verify temp configuration file size***
6. delete downloaded configuration file
7. rename temp configuration filename to downloaded configuration file
8. verify configuration file size
8. upload new configuration file to the ups using ftp
9. verify file was uploaded successfully by checking log file
10. send output to std with ups configuration info

problems:
1. fileexists is not cooperating -false negative.
2. del command is not cooperating -files are not being deleted. when i'm running
   the script, i'm logged in as a user who has administrative rights, and the file i'm attempting to
   delete is not flagged read-only
3. readall doesn't seem to read all of the file into my variable and so my regular expression
   fails to match my pattern. i tested the regular expression in the sells brothers regex
   designer .net application and it works just fine.


      
 
 
Post #: 1
 
 RE: Issue with FileExists, executing del command, and R... - 5/4/2008 8:13:36 AM   
  Fredledingue


Posts: 337
Score: 0
Joined: 5/9/2005
From:
Status: offline
Nowhere in your script is mentioned what strsfxcllogsrc is.
At some point you should have something like that:

strsfxcllogsrc = "C:\somefolder\SomeValidFilePath.txt"

I can't see it anywhere. So the script thinks that strsfxcllogsrc="" (empty string)
Normal it can't find, read let alone delete it.

HTH



_____________________________

Fred

(in reply to vbscoded)
 
 
Post #: 2
 
 RE: Issue with FileExists, executing del command, and R... - 5/4/2008 1:35:14 PM   
  vbscoded

 

Posts: 3
Score: 0
Joined: 5/2/2008
Status: offline
Hi Fredlingue,

Thanks for the reply! I've checked my code and I do have strsfxcllogsrc defined somewhere, I just didn't include it in my post.

vbscoded


(in reply to Fredledingue)
 
 
Post #: 3
 
 RE: Issue with FileExists, executing del command, and R... - 5/4/2008 2:23:48 PM   
  dm_4ever


Posts: 2414
Score: 38
Joined: 6/29/2006
From: Orange County, California
Status: offline
Do you have On Error Resume Next somewhere in your script? If so, comment it out to see if there are any obvious reasons for failures.

Set rearpsccss = New RegExp ' missing the p
rearpsccss.Pattern = "\w"
rearpsccss.IgnoreCase = True

...with the issue of the regular expression not find everything from your objFile.ReadAll....you may try:
regEx.Global = True and/or regEx.MultiLine = True

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to vbscoded)
 
 
Post #: 4
 
 RE: Issue with FileExists, executing del command, and R... - 5/5/2008 9:25:36 AM   
  Fredledingue


Posts: 337
Score: 0
Joined: 5/9/2005
From:
Status: offline
quote:

ORIGINAL: vbscoded

Hi Fredlingue,

Thanks for the reply! I've checked my code and I do have strsfxcllogsrc defined somewhere, I just didn't include it in my post.

vbscoded




I see. But the lines defining  strsfxcllogsrc (aka the file to read and delete) is the crux of the problem.
Without this lines and the other lines affecting this variable, it's difficult to debug your code...

_____________________________

Fred

(in reply to vbscoded)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Issue with FileExists, executing del command, and ReadAll Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts