473,463 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hyper link that opens the newest file in a dir?

Off the wall question:

Is there a way to set a hyperlink so that it opens the newest file in a
directory?

Why: I have a page that is a link to a daily set of reports. A new report
gets output every single night with a new unique name like this:
applicationperformance032520050100.doc

Which is the Application performance report for March 25 2005 out put at
1:00 AM. Tomorrow, a newer report will be there titled:
applicationperformance032620050100.doc

I want to provide a link the "Yesterdays Report" without needing to go in
and edit the link every morning.

Any suggestions?

Thanks

--
Glenn

Jul 23 '05 #1
4 3493
In article <d2**********@fred.mathworks.com>, gl*********@mathworks.com
enlightened us with...

Any suggestions?


Perl, PHP, JSP, Cold Fusion, ASP...
Javascript if you're REALLY stuck for a server-side solution. A bit easier to
do server-side, IMO, but it could be done client-side, assuming the browser
supported it (most do).

Added advantage to server-side: it can tell you if the file is missing. JS
will only write the link.

--
--
~kaeli~
Any sufficiently advanced technology is indistinguishable
from magic.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
"Glenn Mulno" wrote in comp.infosystems.www.authoring.html:
Is there a way to set a hyperlink so that it opens the newest file in a
directory?


Yes, certainly. Remember that href="..." doesn't necessarily
identify a particular static file, or even a file at all. It's
interpreted by the server. Use some special URL and set up the
server to recognize it as a command to find and serve up the newest
file in the directory. Sounds like a job for CGI or similar.

If you're asking can you do it client side, the answer is No: the
client doesn't have the necessary information.

--

Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
Jul 23 '05 #3
Glenn Mulno wrote:
Is there a way to set a hyperlink so that it opens the newest file in a
directory?
Yes, but not in the way you seem to be asking for. In the markup, you
could use a link like this:

<a href="/applicationperformance">Latest Application Performance Report</a>

When a user follows that link, the browser will send a request to the
server, and the server must then determine how to fulfil the request.
You cannot have the browser automatically append the date to the end of
the file URI for you, but even if you could, it wouldn't be reliable
anyway, since it would depend on the user's system having the correct
date set.
Why: I have a page that is a link to a daily set of reports. A new report
gets output every single night with a new unique name like this:
applicationperformance032520050100.doc
That's what makes ISO-8601 so useful. Instead of having a bunch of
numbers that don't seem to be in any logical order, it's easier if you
use YYYY-MM-DD hh:mm. eg. applicationperformance200503250100. That has
the advantage that sorting by file name also sorts by date. Anyway,
regardless of the odd date format you've chosen, you need to provide
some server side processing in order to map a request for
/applicationperformance to the latest file.

You could have applicationperformance.php (or .asp, .jsp or whatever
technology you want to use). You can use Multiviews (or an equivalent
for a non-Apache web server) so you don't have to include the file
extension in the URI.

Within this PHP file, the logic could work like this:

Get todays date.
Generate the filename for today.
(eg. applicationperformance + Month + Day + Year + Hour + Min + ".doc")
Check the file actually exists on the server.
ie. It could possibly be requested before today's report has been
generated and, if that is the case, yesterday's report should be
sent instead.
Either:
- Output the contents of the latest report file found.
- Send a 302 Found or 307 Temporary Redirect response to redirect the
user to the latest file.
I want to provide a link the "Yesterdays Report" without needing to go in
and edit the link every morning.


This could be done in a similar way to the latest report above.
Alternatively, you could use server side processing to automatically
generate the appropriate file name.

eg.
<a href="/applicationperformance<?php date("mdYHi"); ?>.doc">Latest
Application Performance Report</a>
--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Jul 23 '05 #4
Glenn Mulno wrote:
Off the wall question: Is there a way to set a hyperlink so that it opens the newest file in a
directory? Why: I have a page that is a link to a daily set of reports. A new report
gets output every single night with a new unique name like this:
applicationperformance032520050100.doc Which is the Application performance report for March 25 2005 out put at
1:00 AM. Tomorrow, a newer report will be there titled:
applicationperformance032620050100.doc


Why not generate applicationperformancecurrent, and have a script
rename it with the appropriate date when the next
applicationperformancecurrent is generated, 24 hours later? Might not
this be more logically handled at the file system level than at the web
access level? Sure, this is an HTML newsgroup (even though this is a
scripting question) -- but that doesn't mean that a more basic approach
isn't indicated.

--
Blinky Linux Registered User 297263
Who has implemented Usenet Solution #45933:
Now killing all posts originating at Google Groups

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ozz | last post by:
Hi there, I have a link on my web page. When clicked, opens up a pdf file that is stored on my server. Every file is specific to a user's user name and I don't want users to see each other's...
3
by: ajaspersonal | last post by:
"i want to change font_style (hyper link<a href...>text</a>) normal to italics.when load a page" this is my problem but that label included in one 'USERCONTROL' This user controls may...
1
by: Kalaram | last post by:
I am makeing a CD, and in this CD i have alot of .pdf & .ppt & .pps files and i have one html page that i use as index to all the files, when i click on the hyper link of .pdf file , it opens...
3
by: rahullko05 | last post by:
i am using this code in one of my .php file: <a href="thanks.php" onclick = "return registerUser(){return false;}"> <input type="button" name="userText" value="Submit" id="memberRegisteration" />...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.