By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,805 Members | 1,056 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,805 IT Pros & Developers. It's quick & easy.

Check file date of text file

P: n/a
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.

Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
"mb******@hotmail.com" wrote:
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.

Jul 22 '05 #2

P: n/a
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

<mb******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
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.

Jul 22 '05 #3

P: n/a
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?

Jul 22 '05 #4

P: n/a
Yes, I agree. That is most likely your issue. Take a look at
http://www.aspfaq.com/show.asp?id=2168 in the "If the file is within your
LAN" section.

Ray at work

<mb******@hotmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
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?

Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.