Check file date of text file

M

mbosco51

Hi. I am tring to setup an asp script that will do the following...

If file date/time is within last 10 minutes then
response.redirect to file
else
do something else
end if

The text file is not located on the webserver. I created a virtual
directory on the webserver which allows me to response.redirect to the
file. However when I use the FileSystemObject to check the date/time,
I cannot find the file. It seems like it only works against files on
the webserver. UNC paths do not seem to work. I was hoping the
virtual directory would allow me to specify something like
c:\inetpub\wwwroot\<VIRTUAL DIR NAME>\<FILE NAME>, however that's not
working either.

Basically, is there any way to use FileSystemObject against a file not
on the webserver, or can I get the file date/time using something else?

Thanks.
 
M

Mark

Have you tried mapping the network drive? I can understand FileSystemObject
not working on unc paths, but perhaps it would have more luck if you map the
drive and use a more regular path structure?

-Mark
 
R

Ray Costanzo [MVP]

What is the code that you're using now? And when you say UNC paths don't
work, what do you mean? Do you get an error? What does it say? Are you
using the default local IUSR account for your site, or a domain account that
has NTFS and share permissions to these UNC paths?

Ray at work
 
M

mbosco51

This is a production web server, so I'm not sure if I have the rights
to get a permanent mapped drive. Here's the code...

'path of the text file
FilePath = "c:\inetpub\wwwroot\test.txt"
Set File = server.CreateObject("Scripting.FileSystemObject")

'checking that the file exist
If (File.FileExists(FilePath)) Then
Response.Write "File Found"
else
Response.Write "Not Found"
end if

This works fine, but if I set it to a path on the server that really
holds the file...
\\servername\sharename\test.txt
I always get a File Not Found message, even though I know it exists.
The website is running under the default IUSR account. I'm assuming
it's failing because it doesn't have access to view the path in
question. Is it possible to get access for the local IS account on the
file server?
 

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
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top