filescriptingobject problem

M

middletree

On an Intranet app, I want the user to be able to click the word Files, and
be taken to the folder that exists for that particular ticket. On a server
on our network, we have a folder called tickets, and inside, if anyone has
created a folder for a given ticket, it will have the naming convention of
T, then the ticket number. So Ticket #1000 will have a folder called T1000,
and it will be located on the folder called Tickets on that server.

However, if no folder has been created, then I want it to take them to the
root of the Tickets folder. Here's the code, with problem listed below that.

SET fso = CreateObject("Scripting.FileSystemObject")
strTraceDir = "\\servername\tickets\T"&strTicketID
If fso.FolderExists (strTraceDir) then
'don't change anything
Else
strTraceDir = "\\servername\tickets\"
End if
set fso= nothing
%>

<a href="<%=strTraceDir%>" target="_blank">Files:</a>

------------------------------------
For some reason, it is falling into the Else no matter what. Even though the
folder exists, it acts as if it doesn't. It jsut takes you to the root of
Tickets.

I did a response.write on several things, and confirmed that the strTicketID
variable is properly populated. What am I missing?
 
S

Steven Burn

Dim FSO
Dim Fldr
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fldr = FSO.GetFolder(Server.MapPath(""\\servername\tickets"))

If FSO.FolderExists(Server.MapPath(Fldr.Name & "\T"& strTicketID")) Then
'it is there
'Do something
Else 'It's not there
'Do something else
End If

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top