Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FSO file exists not working 1

Status
Not open for further replies.

squirleegirl

Programmer
Jun 24, 2003
59
US
Hello! I am so frustrated right now!!!! I have some code that filters through a directory looking for a certain named file. If it finds it, then it opens it up, reads it into a variable then deletes the file.

However, right now I can't get past the if file exists part (this program is a VB program converted to ASP). I KNOW some files exist - I have intentionally placed some out there. Here is my code:

Set fsoObject = CreateObject("Scripting.FileSystemObject")
Do While Not rst.EOF
count = count + 1
If fsoObject.FileExists("\\server\path\" & rst("record") & "\flag.txt") = true Then
Set f = fsoObject.GetFile("\\server\path\" & rst("record") & "\flag.txt")

Set fsostream = f.OpenAsTextStream(ForReading)

Do While Not fsostream.AtEndOfStream
strline = fsostream.ReadAll
Loop
fsostream.Close
'f.Delete (don't delete until it works!)
Else
'do nothing
End If
rst.movenext
Loop
rst.Close

I know my database record is correct. I've tested and had it print each path it is looking for and they are all correct. It will not get past the if fsoObject.fileexists part - well, more correctly it is not recognizing it as existing - it automatically skips the if and goes to the else. It does loop through all my records though. I've tried if fileexist = true and just if fileexists. I've tried if folderexists on the folder and if so then get the file, but doesn't work either. UGH!!!!! =-)

Does anyone have any ideas?

Thanks in advance - Squirleegirl
 
also with network locations you'll need to add the iusr_machinename of the web server hosting the script to have access, otherwise you wont be able to access the machine from the web page due to permissions

[thumbsup2]DreX
aKa - Robert
 
I tried using an absolute path and still nothing. I have double-checked the permissions and they are okay. =-(

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top