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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading dated file names.

Status
Not open for further replies.

samuelma

MIS
Jun 5, 2001
16
0
0
US
I think I posted the following in the wrong place thinking it was an HTML thing not a VBS thing.
Like I said on the bottom "Am I even close?"

I need to use HTML/VBS to read a TXT file or HTM file
The file names have a DATE in them and are in date order.
examples:
"myfile-07-28-02.txt"
"myfile-07-29-02.txt"
"myfile-07-30-02.txt"

"myfile-07-28-02.htm"
"myfile-07-29-02.htm"
"myfile-07-30-02.htm"

The old way this was done is like this.

<a href=&quot;X:\folder\folder2\myfile.txt&quot; target=&quot;dynamic&quot;>SiteX</a>

The file was replace daily without any history/archive. Keeping the drives mapped to the servers for the various users is, difficult.

The new way copies the files to a folder daily, adding the date stamp to the file name, using the date stamp for history/archival purposes.

The issue is being able to read the &quot;myfile-{date}.txt&quot; in an HTML link.
If I could read the current date from the system, reference that date, find the correct dated file name, and display it. That would be cool. I'm sure this will take some VBS to do I just don't know VBS well enough to be able to do it in HTML.
I'm guessing a function for the date is necessary.
I have one in my code that copies the files.
Code:
Dim myMonth,myDay,myYear,myDate
    myMonth=right(&quot;0&quot; & month(now),2)
    myDay=right(&quot;0&quot; & day(now),2)
    myYear=right(&quot;0&quot; & year(now),2)
    myDate=  MyMonth & &quot;-&quot; &myDay & &quot;-&quot; &myYear
    ReturnTimeStamp=myPath &&quot;-&quot; & myDate & myExtension
end function
I address the file name like this
Code:
Set f1 = fso.CreateTextFile (ReturnTimeStamp(&quot;C:\folder\Myfile-&quot;,&quot;.txt&quot;))
f1.close
Set f2 = fso.getfile(&quot;\\server\folder\folder\results.txt&quot;)
f2.copy (ReturnTimeStamp(&quot;C:\folder\Myfile-&quot;,&quot;.txt&quot;))
Something like this...
Code:
<a href=&quot;C:\folder\myfile-{date}.txt&quot; target=&quot;dynamic&quot;>SiteX</a>

Would be cool but I don't know how to integrate the VBS in to the HTML.

Thanks in advance!

*********************************

Put your vbscript into script tags and make it a function that changes the page source to the value, then instead of putting an address in the href=&quot;..&quot; put href=&quot;#&quot; and use the onCLick to call your vb function. The vb function should build the url you want to go to and then set the doxcument.src (? sorry, rusty, that should be close) to your url string.
-Tarwn

*********************************


Sorry it took so long to get back.
I'm lost when you say &quot;make a function that changes the page source to the value&quot;
I can put the date function (I didn't write it) between the script tags but I don't know how to &quot;change a page source to a value in VBS. I did look at a bunch of help stuff, I don't have a clue as to how to combind what I was looking at. I understand the statement &quot;change the page source to the value&quot; i.e. point from a value to the source. But putting in other then psudo code is another thing.

I think I have to
Code:
Dim valueX, 
   valueX = returntimestamp(c:\filename&quot;,&quot;.txt)
   
   onclick... href=&quot;valueX&quot;... link
Am I even close?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top